I'm currently working on a microservice in AWS using lambdas. On occassion, a lambda call from one to the other will fail when that reciever lambda then calls another lambda. The error is as follows:
errorMessage
Signature expired: 20210825T214414Z is now earlier than 20210825T214616Z (20210825T215116Z - 5 min.)
errorType
InvalidSignatureException
name
InvalidSignatureException
stack.0
InvalidSignatureException: Signature expired: 20210825T214414Z is now earlier than 20210825T214616Z (20210825T215116Z - 5 min.)
stack.1
at deserializeAws_restJson1InvokeCommandError (/var/task/node_modules/@aws-sdk/client-lambda/dist/cjs/protocols/Aws_restJson1.js:5106:41)
stack.2
at runMicrotasks (<anonymous>)
stack.3
at processTicksAndRejections (internal/process/task_queues.js:95:5)
stack.4
at async /var/task/node_modules/@aws-sdk/middleware-serde/dist/cjs/deserializerMiddleware.js:6:20
stack.5
at async /var/task/node_modules/@aws-sdk/middleware-signing/dist/cjs/middleware.js:12:24
stack.6
at async StandardRetryStrategy.retry (/var/task/node_modules/@aws-sdk/middleware-retry/dist/cjs/StandardRetryStrategy.js:51:46)
stack.7
at async /var/task/node_modules/@aws-sdk/middleware-logger/dist/cjs/loggerMiddleware.js:6:22
stack.8
at async InvokeLambdaAdapter.sendCommand (/var/task/invokeLambdaAdapter.js:61:24)
We use the javascript aws lambda client, and run version 3.20. I'm not sure what can be causing this. I thought it was a clock issue but correcting clock skew is baked into the request, and it's not an issue of local clock because lambdas are synced with NTP. Any advice helps!
For anyone curious. The issue ended up being reusing an aws lambda client for multiple requests. When we had the requests create a new client for every request, the issue went away.