I'm facing issue using sts client on lambdas. The current code was working two days ago.
const {
STSClient,
AssumeRoleCommand,
} = require('@aws-sdk/client-sts')
const stsClient = new STSClient({
region: process.env.REGION || 'eu-west-1',
})
const params = new AssumeRoleCommand({
RoleArn: process.env.MARKETPLACE_RESOLVE_CUSTOMER_ROLE_ARN,
RoleSessionName: `${
process.env.AWS_LAMBDA_FUNCTION_NAME
}-${new Date().getTime()}`,
})
const assumedRoleOutput = await stsClient.send(params)
Now it always throws an exception as follow:
2023-02-08T08:07:18.684Z 1a7dd68d-da00-4b07-935c-2f6bc95f996f ERROR TypeError: (0 , smithy_client_1.parseRfc3339DateTimeWithOffset) is not a function
at deserializeAws_queryCredentials (/opt/nodejs/node_modules/@aws-sdk/client-sts/dist-cjs/protocols/Aws_query.js:860:117)
at deserializeAws_queryAssumeRoleResponse (/opt/nodejs/node_modules/@aws-sdk/client-sts/dist-cjs/protocols/Aws_query.js:756:32)
at deserializeAws_queryAssumeRoleCommand (/opt/nodejs/node_modules/@aws-sdk/client-sts/dist-cjs/protocols/Aws_query.js:119:16)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async /opt/nodejs/node_modules/@aws-sdk/client-sts/node_modules/@aws-sdk/middleware-serde/dist-cjs/deserializerMiddleware.js:7:24
at async /opt/nodejs/node_modules/@aws-sdk/client-sts/node_modules/@aws-sdk/middleware-signing/dist-cjs/middleware.js:14:20
at async StandardRetryStrategy.retry (/opt/nodejs/node_modules/@aws-sdk/client-sts/node_modules/@aws-sdk/middleware-retry/dist-cjs/StandardRetryStrategy.js:51:46)
at async /opt/nodejs/node_modules/@aws-sdk/client-sts/node_modules/@aws-sdk/middleware-logger/dist-cjs/loggerMiddleware.js:5:22
at async getMarketplaceResolveCustomerRoleCredentials (/var/task/utils/marketplaceUtils.js:27:29)
at async Object.resolveMarketplaceCustomer (/var/task/utils/marketplaceUtils.js:50:5) {
'$metadata': { attempts: 1, totalRetryDelay: 0 }
I've tried it with the @aws-sdk/client-sts at versions 3.266.0 and 3.224.0