[BUG] Issue in API Error Output & Proxy Handling

Resolved 💬 10 comments Opened Mar 25, 2025 by SC-CTS 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 ↗

This issue has 10 comments on GitHub. Read the full discussion on GitHub ↗