[BUG] Issue in API Error Output & Proxy Handling

Status Fixed / completed
Maintainer reply None cached
Activity 10 comments · opened Mar 25, 2025 · closed Apr 10, 2025

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

  1. Open an AWS SSO session
  2. CLAUDE_CODE_USE_BEDROCK=1 DISABLE_PROMPT_CACHING=1 claude
  3. 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.

View original on GitHub ↗

10 Comments

reverie · 1 year ago

Maybe related to #596

SC-CTS · 1 year ago

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

kushal-thakkar · 1 year ago

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 claude

SC-CTS · 1 year ago

I do have AWS_PROFILE set in the shell but it does use SSO and not aws_access_key_id/aws_secret_access_key

ghost · 1 year ago

Thank you for the report! This should now be resolved.

SC-CTS · 1 year ago

@levpopov resolved in the currently available version or in a future one? Just updated to the latest one and nothing changed.

ghost · 1 year ago

Thanks for the note, @SC-CTS. The current version now respects HTTPS_PROXY env var when configured to use Bedrock. Let me know if you are still seeing issues with HTTPS_PROXY after updating.

Schachte · 1 year ago

@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.

Rakjlou · 1 year ago

@levpopov I still have the same issue described here.

$ claude --version
0.2.115 (Claude Code

It can successfully interrogate update servers

$ claude update
Current version: 0.2.115
Checking for updates...
Claude Code is up to date (0.2.115)

But still fails when connecting to "Anthropic services".
I can interrogate the API just fine with curl.
Proxy has been correctly setup in env and npm.

github-actions[bot] · 1 year ago

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.