[BUG] `awsAuthRefresh` triggers even when AWS credentials are still valid (not expired)
Update: Root Cause Identified
I’ve identified the root cause of the issue.
The failure was due to a missing AWS_REGION environment variable. After explicitly setting AWS_REGION, everything worked as expected.
It appears the SDK or underlying AWS client does not automatically infer the region in this context, which leads to the failure if the variable is not defined.
Adding:
export AWS_REGION=<your-region>
resolved the problem.
Thanks for the help.
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?
I configured awsAuthRefresh in Claude Code’s settings.json, but the command is triggered every time I run Claude, regardless of whether the AWS credentials have expired.
{
"awsAuthRefresh": "aws sso login --profile <MY_PROFILE_NAME>"
}
What Should Happen?
wsAuthRefresh should only run when the AWS credentials are expired.
Error Messages/Logs
none
Steps to Reproduce
set this in ~/.claude/settings.json
{
"awsAuthRefresh": "aws sso login --profile <MY_PROFILE_NAME>"
}
run claude
Claude Model
None
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.9
Platform
AWS Bedrock
Operating System
macOS
Terminal/Shell
iTerm2
Additional Information
_No response_
This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗