[BUG] Issue in API Error Output & Proxy Handling
Environment
- Platform (select one):
- [ ] Anthropic API
- [X] AWS Bedrock
- [ ] Google Vertex AI
- [ ] Other: <!-- specify -->
- Claude CLI version: 0.2.53 (Claude Code)
- Operating System: macOS 15.3.2
- Terminal: Ghostty
Bug Description
When I try to use claude code with AWS bedrock it outputs an erro without description:
⎿ API Error:
That's all it outputs.
After poking around in the minfied cli.js and adding some logs I got this:
u4 [Error]
at file:///Users/XXX/.local/share/mise/installs/node/22.14.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1045:22585
at process.processTicksAndRejections (node:internal/process/task_queues:105:5) {
cause: nX1 [CredentialsProviderError]
at nX1.from (file:///Users/XXX/.local/share/mise/installs/node/22.14.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:218:31750)
at Object.wk9 [as resolveSSOCredentials] (file:///Users/XXX/.local/share/mise/installs/node/22.14.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:248:41745)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async Y (file:///Users/XXX/.local/share/mise/installs/node/22.14.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:218:33040)
at async file:///Users/XXX/.local/share/mise/installs/node/22.14.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:218:33263
at async Ul9 (file:///Users/XXX/.local/share/mise/installs/node/22.14.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1058:1355)
at async y22 (file:///Users/XXX/.local/share/mise/installs/node/22.14.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1058:655)
at async $11.prepareRequest (file:///Users/XXX/.local/share/mise/installs/node/22.14.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1058:6258)
at async $11.makeRequest (file:///Users/XXX/.local/share/mise/installs/node/22.14.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1045:7461) {
tryNextLink: false,
code: 'ECONNREFUSED',
'$metadata': { attempts: 4, totalRetryDelay: 352 }
}
}
Due to the CredentialsProviderError and resolveSSOCredentials in the logs I am thinking that maybe the AWS SDK client is not using the proxy correctly. From experience I know that e.g. fromSSO from the @aws-sdk/credential-providers library requires a requestHandler in the clientConfig to route the requests through the proxy, maybe something like that is missing here?
Steps to Reproduce
- Open an AWS SSO session
CLAUDE_CODE_USE_BEDROCK=1 DISABLE_PROMPT_CACHING=1 claude- Ask any question
Expected Behavior
Claude should respond.
Actual Behavior
Error get's logged without any details or message.
Additional Context
I am behind a corporate proxy and have all proxy env variables set to a local alpaca instance (https://github.com/samuong/alpaca) to ensure proxy access works.
AWS login is handled through SSO with aws sso login --sso-session YYY with corresponding configuration in .aws/config like:
[profile claude]
sso_session = YYY
sso_account_id = 123
sso_role_name = role-name
region = us-east-1
The AWS SSO login works fine on the command line.
10 Comments
Maybe related to #596
It seems that proxy support in general does not affect all connections claude code makes according to the newer comments in https://github.com/anthropics/claude-code/issues/217
I'm able to repro this with the mentioned steps but when I specify the AWS profile using a shell variable (
AWS_PROFILE) then it works correctly for me. So the step 2 for you should like this:CLAUDE_CODE_USE_BEDROCK=1 DISABLE_PROMPT_CACHING=1 AWS_PROFILE=claude claudeI do have AWS_PROFILE set in the shell but it does use SSO and not aws_access_key_id/aws_secret_access_key
Thank you for the report! This should now be resolved.
@levpopov resolved in the currently available version or in a future one? Just updated to the latest one and nothing changed.
Thanks for the note, @SC-CTS. The current version now respects
HTTPS_PROXYenv var when configured to use Bedrock. Let me know if you are still seeing issues withHTTPS_PROXYafter updating.@levpopov Still having issues when not using bedrock but attempting to use HTTP/S proxy. Configuration looks good on my end. Proxy works with everything else I use.
@levpopov I still have the same issue described here.
It can successfully interrogate update servers
But still fails when connecting to "Anthropic services".
I can interrogate the API just fine with
curl.Proxy has been correctly setup in
envandnpm.This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.