Repository navigation
fix: drop empty Bedrock token and runtime-host base URL from CLI env - #1902
Open
WeAreResilience wants to merge 1 commit into
Open
WeAreResilience wants to merge 1 commit into
WeAreResilience wants to merge 1 commit into
Conversation
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: WeAreResilience <286555414+WeAreResilience@users.noreply.github.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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