Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vertex "Could not resolve API token from the environment" #586

Closed
kkhangv opened this issue Jul 10, 2024 · 9 comments
Closed

Vertex "Could not resolve API token from the environment" #586

kkhangv opened this issue Jul 10, 2024 · 9 comments
Labels
bug Something isn't working vertex

Comments

@kkhangv
Copy link

kkhangv commented Jul 10, 2024

Screenshot 2024-07-10 at 4 56 29 PM For some reasons after the update, Vertex now keeps asking for API Tokens but we are using GCP service account to authorize VertexAI and it was fine until this morning. Did the new release change or require something new?
@kkhangv
Copy link
Author

kkhangv commented Jul 10, 2024

I downgraded to the previous version and it worked. Hopefully not a wide spread Issue.

@RobertCraigie
Copy link
Collaborator

RobertCraigie commented Jul 11, 2024

Hey @kkhangv, sorry about this, can you share more details on how you're authenticating? Where is that error coming from - is there a stack trace?

Nothing new should be required in the last release but we did change some of our logic around handling google credentials but it was not intentionally breaking.

@RobertCraigie RobertCraigie added bug Something isn't working vertex labels Jul 11, 2024
@kkhangv
Copy link
Author

kkhangv commented Jul 11, 2024

Using oauth2:

`from google.oauth2 import service_account
from google.auth.credentials import Credentials

def get_gcp_credentials() -> tuple[Credentials, str, str]:
key_dict = {`

@hantusk
Copy link

hantusk commented Jul 17, 2024

Just hit this as well. Can confirm downgrading to anthropic==0.30 works here.

Service account has the "Vertex AI User" role in gcp, and my auth is set up like this:

claude = AnthropicVertex(region=region, project_id=project, credentials=google.auth.load_credentials_from_file('credentials.json', scopes=["https://www.googleapis.com/auth/cloud-platform"])[0])

@RobertCraigie
Copy link
Collaborator

Thanks both, unfortunately I'm struggling to reproduce this but I've merged a change that I think should fix this issue.

Would anyone be able to test this out and let me know if it works for you? thanks!

python -m pip install -U git+https://github.com/anthropics/anthropic-sdk-python@next

@hantusk
Copy link

hantusk commented Jul 17, 2024

Yup that works for me 👍 consider having a separate version number or suffix for the next branch.

@RobertCraigie
Copy link
Collaborator

RobertCraigie commented Jul 17, 2024

Awesome, thanks!

consider having a separate version number or suffix for the next branch.

Ah we have a separate PR that includes the version bump: #595

So until that's released (hopefully later today) you can use that branch if you want the version bump

python -m pip install -U git+https://github.com/anthropics/anthropic-sdk-python@release-please--branches--main--changes--next

@RobertCraigie
Copy link
Collaborator

v0.31.2 has been released with this fix!

@kkhangv
Copy link
Author

kkhangv commented Jul 17, 2024

Amazing. Save lots of people! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working vertex
Projects
None yet
Development

No branches or pull requests

3 participants