aws-sdk-js icon indicating copy to clipboard operation
aws-sdk-js copied to clipboard

AWS STS Regionalized endpoints not applied by SDK for JavaScript 2.x

Open Fotiman opened this issue 2 years ago • 2 comments

Describe the bug

According to the AWS STS Regionalized endpoints documentation, setting the AWS_STS_REGIONAL_ENDPOINTS environment variable to regional should cause the SDK to always use the regional endpoint (ie - "https://sts.<region>.amazonaws.com") instead of the global service endpoint (ie - "https://sts.amazonaws.com"). However, setting this environment variable has no effect, and requests continue to be sent to the global service endpoint.

Is the issue in the browser/Node.js? Node.js

Details of the browser/Node.js version 16.11.1

Expected Behavior

When AWS_STS_REGIONAL_ENDPOINTS is set to 'regional', I expected requests to be sent to the regional endpoint.

Current Behavior

When AWS_STS_REGIONAL_ENDPOINTS is set to 'regional', the SDK still sends requests to the global endpoint.

Reproduction Steps

process.env.AWS_STS_REGIONAL_ENDPOINTS = 'regional';
const STS = require('aws-sdk/clients/sts');
const stsClient = new STS({
  region: 'us-west-2'
});
stsClient.assumeRole({}) // Request sent to global endpoint

Possible Solution

No response

Additional Information/Context

No response

SDK version used

2.1145.0

Environment details (OS name and version, etc.)

Windows 10

Fotiman avatar May 31 '22 20:05 Fotiman

Hey @Fotiman thanks for opening this issue, I was able to reproduce this, interestingly its still sent to wrong endpoint if I add it to the config file.

ajredniwja avatar Jun 13 '22 14:06 ajredniwja

there is an opt-in config for STS called stsRegionalEndpoints which should be set to "regional" (string).

Does using the constructor to set this value work?

kuhe avatar Nov 22 '23 18:11 kuhe