claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

[BUG] AWS_PROFILE in settings.json not working

Open K3UL opened this issue 4 months ago • 4 comments

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

When I set the environment variable AWS_PROFILE in the global settings, it is not used. If I set it directly in my system (with export ) it works.

What Should Happen?

I should be able to use authentication with custom profile and set it in the claude code settings, in order to not interfere with aws commands outside of Claude Code.

Error Messages/Logs

When using the settings file to set the variable, the debug file contains the following : 

[ERROR] Error streaming, falling back to non-streaming mode: Could not load credentials from any providers
[ERROR] Error streaming, falling back to non-streaming mode: Could not load credentials from any providers

Steps to Reproduce

  1. In .aws/config add a custom profile for auth, that calls a script
[profile custom-auth]
credential_process = /home/mickael/.claude/scripts/aws_creds.sh
  1. Confirm it is working : aws sts get-caller-identity --profile custom-auth
  2. Add AWS_PROFILE to .claude/settings.json
{
  "env": {
    "CLAUDE_CODE_USE_BEDROCK": "1",
    "DISABLE_PROMPT_CACHING": "1",
    "AWS_PROFILE": "custom-auth"
  },
  "model": "eu.anthropic.claude-3-7-sonnet-20250219-v1:0"
}
  1. Running claude --debug and then prompting test just hangs, and the debug log shows the errors above
  2. Exit, manually set the environment variable : export AWS_PROFILE=custom-auth
  3. Running claude and prompting test now works and gets a response

Claude Model

Sonnet (default)

Is this a regression?

I don't know

Last Working Version

No response

Claude Code Version

2.0.22

Platform

AWS Bedrock

Operating System

Ubuntu/Debian Linux

Terminal/Shell

WSL (Windows Subsystem for Linux)

Additional Information

  1. I feel like this is somehow related to #5418.
  2. I also tried with CLAUDE_CODE_AWS_PROFILE as I was not sure which it is supposed to be.
  3. This probably worked before as it was mentioned in #148 in this comment https://github.com/anthropics/claude-code/issues/148#issuecomment-2852648857 but I never tried it before

K3UL avatar Oct 19 '25 14:10 K3UL

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/7660
  2. https://github.com/anthropics/claude-code/issues/8500
  3. https://github.com/anthropics/claude-code/issues/5418

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

github-actions[bot] avatar Oct 19 '25 14:10 github-actions[bot]

  • Not a duplicate of 7660 because it happens with Node 24 and Node 20
  • Not a duplicate of 8500 because it is not the same use case
  • Not a duplicate of 5418 but as I originally said it is possibly related. Your checks specifically mention to open an issue for a single bug report

K3UL avatar Oct 19 '25 14:10 K3UL

we have a similar issue, with 2.0.31, we're yet to understand why it happens

alexef avatar Nov 06 '25 09:11 alexef

This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.

github-actions[bot] avatar Dec 12 '25 10:12 github-actions[bot]