From 906a6b52b8be22ae4d0e34634bd5405ac6ff3127 Mon Sep 17 00:00:00 2001 From: Dave Horton Date: Wed, 29 Nov 2023 14:17:46 -0500 Subject: [PATCH] fix issue with conflicting EC2 permissions calling AWS STS --- lib/get-aws-sts-token.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/get-aws-sts-token.js b/lib/get-aws-sts-token.js index 93f6f24..cc746eb 100644 --- a/lib/get-aws-sts-token.js +++ b/lib/get-aws-sts-token.js @@ -14,13 +14,14 @@ async function getAwsAuthToken( if (obj) return {...obj, servedFromCache: true}; /* access token not found in cache, so generate it using STS */ - const stsClient = new STSClient({ region: awsRegion }); - const params = { - accessKeyId: awsAccessKeyId, - secretAccessKey: awsSecretAccessKey, - DurationSeconds: EXPIRY - }; - const command = new GetSessionTokenCommand(params); + const stsClient = new STSClient({ + region: awsRegion, + credentials: { + accessKeyId: awsAccessKeyId, + secretAccessKey: awsSecretAccessKey, + } + }); + const command = new GetSessionTokenCommand({DurationSeconds: EXPIRY}); const data = await stsClient.send(command); const credentials = {