Skip to content

Commit 05b6f8a

Browse files
authored
Merge pull request #18 from flexion/fix/bedrock-bearer-token-iam-precedence
fix: let IAM credentials take precedence over stored Bedrock API key
2 parents c99a0a2 + 3516f99 commit 05b6f8a

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

packages/opencode/src/provider/provider.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,8 @@ function custom(dep: CustomDep): Record<string, CustomLoader> {
262262
const awsBearerToken = iife(() => {
263263
const envToken = process.env.AWS_BEARER_TOKEN_BEDROCK
264264
if (envToken) return envToken
265-
if (auth?.type === "api") {
265+
// Only treat stored auth key as a bearer token when no IAM credentials exist.
266+
if (auth?.type === "api" && !awsAccessKeyId && !profile) {
266267
process.env.AWS_BEARER_TOKEN_BEDROCK = auth.key
267268
return auth.key
268269
}

0 commit comments

Comments
 (0)