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
Bedrock /connect forces API key prompt, breaks IAM credential chain auth #29499
/connect → amazon-bedrock has no plugin-defined auth methods, so it falls through to the generic "Enter your API key" prompt with no way to skip. Users authenticating via IAM credentials (access keys, profiles, instance roles) must enter a dummy value.
That dummy value gets stored in auth.json and treated as a bearer token on next bootstrap — the custom handler sets process.env.AWS_BEARER_TOKEN_BEDROCK to the dummy value, which skips the credential chain entirely. The SDK sends the dummy string as a bearer token and Bedrock rejects it:
Forbidden: {"Message":"Invalid API Key format: Must start with pre-defined prefix"}
Workaround: rm ~/.local/share/opencode/auth.json and restart opencode.
Additionally, the autoload gate in provider.ts requires explicit env var signals (AWS_ACCESS_KEY_ID, AWS_PROFILE, etc.) — EC2 instance profiles via IMDS and default ~/.aws/credentials profiles without AWS_PROFILE set cannot autoload.
Plugins
None
OpenCode version
1.15.11
Steps to reproduce
Set AWS_ACCESS_KEY_ID + AWS_SECRET_ACCESS_KEY in env (or have an AWS profile configured)
Run opencode, verify Bedrock models work
Run /connect, select amazon-bedrock
Enter any string (e.g. test) in the forced API key prompt
Select a model
Send a message — get 403 Forbidden: Invalid API Key format
Switching models or restarting opencode reproduces the error until auth.json is deleted
Activity
github-actions commentedon Jul 27, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.