-
Notifications
You must be signed in to change notification settings - Fork 633
Description
Checkboxes for prior research
- I've gone through Developer Guide and API reference
- I've checked AWS Forums and StackOverflow.
- I've searched for previous similar issues and didn't find any solution.
Describe the bug
When invoking fromNodeProviderChain
using IAM AssumeRoleWithWebIdentity I expect environment variables AWS_REGION
/ AWS_DEFAULT_REGION
/ AWS_STS_REGIONAL_ENDPOINTS
to control the region that the STSClient
uses to send the http request. However, it can be observed that the request is always routed to us-east-1
unless the region is programmatically set.
Documentation References:
- https://docs.aws.amazon.com/sdkref/latest/guide/feature-region.html
- https://docs.aws.amazon.com/sdkref/latest/guide/feature-sts-regionalized-endpoints.html
SDK version number
@aws-sdk/[email protected]
Which JavaScript Runtime is this issue in?
Node.js
Details of the browser/Node.js/ReactNative version
v20.2.0
Reproduction Steps
Running the fromNodeProviderChain
function with http debugging turned on, like so:
node="$(which node)"
env -i \
NODE_DEBUG="http" \
AWS_WEB_IDENTITY_TOKEN_FILE="..path../web_token_file" \
AWS_ROLE_ARN="arn:aws:iam::xxxxxxxxxxxx:role/xxx" \
AWS_STS_REGIONAL_ENDPOINTS="regional" \
AWS_REGION="us-west-2" \
$node -e \
"require('@aws-sdk/credential-providers').fromNodeProviderChain()().then(() => console.log('success'), e => console.log('error', e))"
Observed Behavior
Logs
HTTP 30987: createConnection sts.us-east-1.amazonaws.com:443
to the terminal, indicating the region variable and the sts_regional_endpoints are not having the desired effect.
Expected Behavior
The AWS_REGION
variable along with the AWS_STS_REGIONAL_ENDPOINTS
setting should have made the API call contact sts.us-west-2.amazonaws.com:443
Possible Solution
No response
Additional Information/Context
No response