Repository navigation
fix: drop empty Bedrock token and runtime-host base URL from CLI env - #1902
WeAreResilience wants to merge 1 commit into
Conversation
|
Thanks for this PR and for spelling out which client reads which variable; that made it quick to re-check against the Claude Code bumps since #1896. On main
So on current main, the The PR still merges onto Run outputStub endpoint, fake SigV4 keys, Real Bedrock, Claude Code 2.1.317, a throwaway application profile copied from Two CHANGELOG entries look related but don't cover this lookup. 2.1.309 "Fixed fine-grained tool streaming staying off on Amazon Bedrock when Agent SDK 0.3.317 still spawns the CLI with a copy of |
|
Thanks @kimnamu, that's a really thorough re-check. Good to know the empty-token part stopped reproducing in Claude Code 2.1.314 while the Since the base URL change is the part that still fixes #1896, I'm happy to narrow the change to just that if the maintainers would rather keep it minimal. Otherwise I'll leave the empty-token drop in as a harmless guard. Just let me know which you prefer. |
|
Ready for review whenever you have a moment; happy to narrow to only the ANTHROPIC_BEDROCK_BASE_URL change if that is preferred. |
action.yml defaulted ANTHROPIC_BEDROCK_BASE_URL to the bedrock-runtime host. Claude Code also uses that variable as the endpoint of its Bedrock control-plane client, so GetInferenceProfile went to bedrock-runtime and application inference profiles never resolved to a backing model. The step also exported AWS_BEARER_TOKEN_BEDROCK as an empty string when the workflow did not set it. The AWS SDK selects bearer auth whenever that variable exists, so SigV4 credentials from OIDC were ignored for those calls. Pass ANTHROPIC_BEDROCK_BASE_URL through unchanged and drop either value from the CLI env when it is empty, so Claude Code falls back to its regional defaults and SigV4. Fixes anthropics#1896 Signed-off-by: David Billiot <info@we-are-resilience.com>
8fe4075 to
c7f113f
Compare
Summary
Fixes #1896. With
use_bedrock: "true"and an application inference profile ARN as the model, Claude Code could not resolve the profile's backing model because of two values the run step passes to the CLI:ANTHROPIC_BEDROCK_BASE_URLdefaulted tohttps://bedrock-runtime.<region>.amazonaws.com. Claude Code (2.1.299, the pinned version) builds its control-planeBedrockClientwithendpoint: ANTHROPIC_BEDROCK_BASE_URLwhen the variable is set, soGetInferenceProfilewent tobedrock-runtime. Unset, that client usesbedrock.<region>.amazonaws.com, and the runtime client already defaults to thebedrock-runtimehost.AWS_BEARER_TOKEN_BEDROCKwas exported as""when the workflow did not set it. The AWS SDK's auth scheme selector pickshttpBearerAuthwheneverAWS_BEARER_TOKEN_<signing name>exists in the environment, so the OIDC SigV4 credentials were not used and the lookup failed with "request could not be signed withtokensince thetokenis not defined".Both
action.ymlfiles now passANTHROPIC_BEDROCK_BASE_URLthrough unchanged, andparseSdkOptionsdrops either variable from the CLI env when it is empty or whitespace. A workflow that sets either value keeps it as before. The base-action README note on the endpoint is updated to match.Not tested against a real Bedrock account. I reproduced the signing error with the bundled 2.1.299 CLI, fake SigV4 credentials,
AWS_BEARER_TOKEN_BEDROCK=and an inference profile ARN, and read the endpoint and auth selection in that binary.Test plan
bun testin the repo root and inbase-action/(no new failures; the root's 27 git-based failures are the same set on unmodifiedmainin my environment)bun run typecheck(root andbase-action/) andbun run format:checkparseSdkOptionstests: each variable is dropped when empty or whitespace, kept when set, and not added when unset; the drop cases fail without the changeaction.ymlfiles assertANTHROPIC_BEDROCK_BASE_URLmaps straight fromenv; they fail onmain