Skip to content

Commit 0a269ad

Browse files
committed
fix(bedrock): key client cache on full credential, not just access key id
A corrected secret under the same access key id would otherwise keep serving the stale cached client until TTL/eviction. Caught by Cursor Bugbot.
1 parent a349fc7 commit 0a269ad

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

apps/sim/providers/bedrock/index.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,14 @@ export const bedrockProvider: ProviderConfig = {
139139
}
140140
}
141141

142+
// Key on the full credential (access key id + secret) so a corrected secret
143+
// under the same access key id yields a fresh client rather than a stale one.
144+
const credentialKey =
145+
request.bedrockAccessKeyId && request.bedrockSecretKey
146+
? `${request.bedrockAccessKeyId}:${request.bedrockSecretKey}`
147+
: 'default-chain'
142148
const client = getCachedProviderClient(
143-
`bedrock::${region}::${request.bedrockAccessKeyId ?? 'default-chain'}`,
149+
`bedrock::${region}::${credentialKey}`,
144150
() => new BedrockRuntimeClient(clientConfig)
145151
)
146152

0 commit comments

Comments
 (0)