Skip to content

SNS publish issue with CredentialsProviderError #2659

@tdschwebach

Description

@tdschwebach

We're writing code in TypeScript v4.3.2, running NodeJs v14 and using "@aws-sdk/client-sns": "3.20.0".

We're able to publish messages for a while, sometimes days, sometimes hours and then we start receiving the following error message out of the blue:

error: {"tryNextLink":false,"name":"CredentialsProviderError","$metadata":{"attempts":1,"totalRetryDelay":0}}
message: Could not load credentials from any providers
metadata: { [-]
attempts: 1
totalRetryDelay: 0
}
name: CredentialsProviderError
stack: CredentialsProviderError: Could not load credentials from any providers
at providers (/app/node_modules/@aws-sdk/credential-provider-node/dist/cjs/index.js:58:19)
at /app/node_modules/@aws-sdk/property-provider/dist/cjs/chain.js:20:28
at runMicrotasks ()
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async SignatureV4.signRequest (/app/node_modules/@aws-sdk/signature-v4/dist/cjs/SignatureV4.js:84:29)
at async /app/node_modules/@aws-sdk/middleware-signing/dist/cjs/middleware.js:14:22
at async StandardRetryStrategy.retry (/app/node_modules/@aws-sdk/middleware-retry/dist/cjs/StandardRetryStrategy.js:51:46)
at async /app/node_modules/@aws-sdk/middleware-logger/dist/cjs/loggerMiddleware.js:6:22
}

We create our SNSClient as follows and it's created once, when the service starts up.
this.snsClient = new SNSClient({ region: 'us-west-2' });

To publish we have a method that we call with this code:
return this.snsClient
.send(new PublishCommand(params))
.then(response => {
this.logger.log(Sent mid: ${response.MessageId});
return true;
})
.catch(error => {
this.logger.error(error);
return false;
});

We're running inside K8s and restarting the pod resolves the issue although it would be nice to make this issue go away altogether, which is the goal of thread. We're only publishing a few hundred messages a day.

Metadata

Metadata

Assignees

No one assigned

    Labels

    closed-for-stalenessguidanceGeneral information and guidance, answers to FAQs, or recommended best practices/resources.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions