fix: let the AWS SDK determine the STS regional endpoint (#48)

This commit is contained in:
Clare Liguori
2020-03-18 13:55:16 -07:00
committed by GitHub
parent a633ed5e02
commit fc72bd38db
+1 -3
View File
@@ -1,7 +1,6 @@
const core = require('@actions/core'); const core = require('@actions/core');
const aws = require('aws-sdk'); const aws = require('aws-sdk');
const assert = require('assert'); const assert = require('assert');
const util = require('util');
// The max time that a GitHub action is allowed to run is 6 hours. // The max time that a GitHub action is allowed to run is 6 hours.
// That seems like a reasonable default to use if no role duration is defined. // That seems like a reasonable default to use if no role duration is defined.
@@ -131,10 +130,9 @@ async function exportAccountId(maskAccountId, region) {
} }
function getStsClient(region) { function getStsClient(region) {
const endpoint = util.format('https://sts.%s.amazonaws.com', region);
return new aws.STS({ return new aws.STS({
region, region,
endpoint, stsRegionalEndpoints: 'regional',
customUserAgent: USER_AGENT customUserAgent: USER_AGENT
}); });
} }