You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
google-vertex: AWS workload identity federation fails on google-auth-library 10.5.0 (fixed in 10.6.1) #66427
packages/ai pins google-auth-library to exactly 10.5.0. However, that version cannot authenticate through Workload Identity Federation from AWS when the AWS role credentials come from a metadata endpoint. So for those setups, the google-vertex provider cannot authenticate at all.
Cause: There's a bug in google-auth-library versions 10.0.0 through 10.5.0 that was fixed in version 10.6.1: the role's credentials (.../meta-data/iam/security-credentials/<role>) are requested without responseType: 'json' so gaxios only parses the body as JSON when the response is labelled application/json. However, the metadata endpoint serves the response as text/plain so the library gets a string and reads AccessKeyId, SecretAccessKey and Token as undefined. It then signs the AWS GetCallerIdentity request without valid keys, and the token exchange fails with AWS InvalidClientTokenId.
In Opencode the ADC error handler in packages/ai/src/providers/google-vertex-shared.ts replaces that error with Missing auth credential: Google Application Default Credentials so the failure looks like missing credentials instead of a library bug.
Could packages/ai move to google-auth-library 10.6.1 or later?
Plugins
None
OpenCode version
2.4.1 (dev pins google-auth-library 10.5.0 also)
Steps to reproduce
Create a Workload Identity Federation credential config for an AWS provider: gcloud iam workload-identity-pools create-cred-config ... --aws It reads role credentials from an endpoint.
On a machine whose AWS role is served at that endpoint, with AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY unset, set GOOGLE_APPLICATION_CREDENTIALS to that config
Send a prompt to any google-vertex model. It fails with Missing auth credential: Google Application Default Credentials.
Took this: the pin was 10.5.0, so the fix is the version bump you asked for.
packages/ai now pins [email protected] — the current 10.x rather than 11.x, so the AnyAuthClient / GoogleAuthOptions types this package imports keep their major. bun install resolves it (the lock records 10.9.1 and its own transitive set), packages/ai is 2304 tests green, and typecheck is clean.
What I can't do from here is exercise the failing path: WIF from AWS needs a role served from a metadata endpoint. The PR says that plainly instead of implying it was tested against AWS.
Branch google-auth-library-10. PR creation is currently refused for this account (the GraphQL API returns FORBIDDEN: does not have the correct permissions to execute CreatePullRequest, which REST hides as 404), so it is ready as a branch with the body written until that clears.
Thanks, Guembri01, for preparing the 10.9.1 upgrade. I replayed the reported failure on your public commit 049aaaec and its parent fb56d1cd. Tested commit
With 10.5.0, the text/plain IMDSv2 role response led to a rejected token exchange and OpenCode reported missing Google ADC. With 10.9.1, the exchange succeeded and the Vertex provider returned the fixture response. AWS environment-variable credentials passed on both commits and bypassed IMDS. Both paths also passed after installing an npm tarball built from your branch.
The replay used OpenCode's actual Vertex provider with synthetic credentials and local IMDSv2, Google STS, and Vertex endpoints.
Activity
Guembri01 commentedon Nov 25, 2026
Took this: the pin was
10.5.0, so the fix is the version bump you asked for.packages/ainow pins[email protected]— the current 10.x rather than 11.x, so theAnyAuthClient/GoogleAuthOptionstypes this package imports keep their major.bun installresolves it (the lock records10.9.1and its own transitive set),packages/aiis 2304 tests green, and typecheck is clean.What I can't do from here is exercise the failing path: WIF from AWS needs a role served from a metadata endpoint. The PR says that plainly instead of implying it was tested against AWS.
Branch
google-auth-library-10. PR creation is currently refused for this account (the GraphQL API returnsFORBIDDEN: does not have the correct permissions to execute CreatePullRequest, which REST hides as 404), so it is ready as a branch with the body written until that clears.LyleLiu666 commentedon Nov 25, 2026
Thanks, Guembri01, for preparing the 10.9.1 upgrade. I replayed the reported failure on your public commit
049aaaecand its parentfb56d1cd. Tested commitWith 10.5.0, the
text/plainIMDSv2 role response led to a rejected token exchange and OpenCode reported missing Google ADC. With 10.9.1, the exchange succeeded and the Vertex provider returned the fixture response. AWS environment-variable credentials passed on both commits and bypassed IMDS. Both paths also passed after installing an npm tarball built from your branch.The replay used OpenCode's actual Vertex provider with synthetic credentials and local IMDSv2, Google STS, and Vertex endpoints.
fix(ai): update bun.lock for google-auth-library 10.6.1
fix(ai): move google-auth-library to 10.9.1
fix(ai): move google-auth-library to 10.9.1