Vertex "Could not resolve API token from the environment"
kkhangv opened this issue ยท 9 comments
I downgraded to the previous version and it worked. Hopefully not a wide spread Issue.
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.
Using oauth2:
`from google.oauth2 import service_account
from google.auth.credentials import Credentials
def get_gcp_credentials() -> tuple[Credentials, str, str]:
key_dict = {`
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])
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
Yup that works for me ๐ consider having a separate version number or suffix for the next
branch.
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
v0.31.2
has been released with this fix!
Amazing. Save lots of people! :)