feat(opencode): add AWS Web Identity Token File support for Bedrock (#8461)
This commit is contained in:
@@ -197,16 +197,23 @@ export namespace Provider {
|
||||
return undefined
|
||||
})
|
||||
|
||||
if (!profile && !awsAccessKeyId && !awsBearerToken) return { autoload: false }
|
||||
const awsWebIdentityTokenFile = Env.get("AWS_WEB_IDENTITY_TOKEN_FILE")
|
||||
|
||||
const { fromNodeProviderChain } = await import(await BunProc.install("@aws-sdk/credential-providers"))
|
||||
|
||||
// Build credential provider options (only pass profile if specified)
|
||||
const credentialProviderOptions = profile ? { profile } : {}
|
||||
if (!profile && !awsAccessKeyId && !awsBearerToken && !awsWebIdentityTokenFile) return { autoload: false }
|
||||
|
||||
const providerOptions: AmazonBedrockProviderSettings = {
|
||||
region: defaultRegion,
|
||||
credentialProvider: fromNodeProviderChain(credentialProviderOptions),
|
||||
}
|
||||
|
||||
// Only use credential chain if no bearer token exists
|
||||
// Bearer token takes precedence over credential chain (profiles, access keys, IAM roles, web identity tokens)
|
||||
if (!awsBearerToken) {
|
||||
const { fromNodeProviderChain } = await import(await BunProc.install("@aws-sdk/credential-providers"))
|
||||
|
||||
// Build credential provider options (only pass profile if specified)
|
||||
const credentialProviderOptions = profile ? { profile } : {}
|
||||
|
||||
providerOptions.credentialProvider = fromNodeProviderChain(credentialProviderOptions)
|
||||
}
|
||||
|
||||
// Add custom endpoint if specified (endpoint takes precedence over baseURL)
|
||||
|
||||
Reference in New Issue
Block a user