InvalidSignature in Node with AWS SDK

Sometimes you run into a weird issue that is hard to debug. This was one of those times. I was working on a Lambda function that was supposed to retrieve a secret from AWS Secrets Manager. However, I kept getting random InvalidSignatureException errors in production.

AWS Parameter Store vs AWS Secrets

Recently I’ve been using AWS Secrets to retrieve API keys which are needed to access external API’s, however, this turned out to be a more expensive service than we initially thought when starting.