AWS node.js SDK Error - SignatureDoesNotMatch: Signature expired
Node.js version 0.10.25
AWS SDK version latest - 2.0.23
I have an application that is constantly listening to a queue (SQS) and if there are messages sent on that queue the application will read the message and process it and save some data to S3. When I launch the application after about 20 minutes, I keep getting the following error.
Potentially unhandled rejection [160] SignatureDoesNotMatch: Signature expired: 20141104T062952Z is now earlier than 20141104T062952Z (20141104T064452Z - 15 min.)
at Request.extractError (/myproject/node_modules/aws-sdk/lib/protocol/query.js:39:29)
at Request.callListeners (/myproject/node_modules/aws-sdk/lib/sequential_executor.js:100:18)
at Request.emit (/myproject/node_modules/aws-sdk/lib/sequential_executor.js:77:10)
at Request.emit (/myproject/node_modules/aws-sdk/lib/request.js:604:14)
at Request.transition (/myproject/node_modules/aws-sdk/lib/request.js:21:12)
at AcceptorStateMachine.runTo (/myproject/node_modules/aws-sdk/lib/state_machine.js:14:12)
at /myproject/node_modules/aws-sdk/lib/state_machine.js:26:10
at Request.<anonymous> (/myproject/node_modules/aws-sdk/lib/request.js:22:9)
at Request.<anonymous> (/myproject/node_modules/aws-sdk/lib/request.js:606:12)
at Request.callListeners (/myproject/node_modules/aws-sdk/lib/sequential_executor.js:104:18)
This is not a problem with my system time. My system time is synchronized with the time of my EC2 instance. Why am I getting this error? Is this related to SQS or S3?
source to share
Thanks to Lauren Segal (Amazon) for his quick response. See https://github.com/aws/aws-sdk-js/issues/401 for details . In short, the SDK does not repeat signature errors for which work around
AWS.events.on('retry', function(resp) {
if (resp.error.code === 'SignatureDoesNotMatch') {
resp.error.retryable = true;
}
});
This is not a regression, i.e. this is not a bug introduced in2.0.23
source to share
I know this is an old question, but I experienced it myself today.
Fortunately, the AWS NodeJS SDK also now has this configuration parameter correctClockSkew
, which fixes the system clock offset after an error occurs:
http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/Config.html#correctClockSkew-property
source to share