5

Node.js 版本0.10.25

AWS 开发工具包版本latest - 2.0.23

我有一个持续监听队列(SQS)的应用程序,如果该队列中发布了消息,该应用程序将读取消息并处理它并将一些数据保存到 S3。当我在大约 20 分钟后启动应用程序时,我不断收到以下错误。

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)

这不是我的系统时间的问题。我的系统时间与我的 EC2 实例的时间同步。为什么我会收到此错误?它与SQS或S3有关吗?

4

3 回答 3

4

我知道这是一个老问题,但我今天亲身经历了。

幸运的是,AWS NodeJS 开发工具包现在有这个名为 的配置选项correctClockSkew,一旦发生错误,它将修复系统时钟偏移:

http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/Config.html#correctClockSkew-property

于 2015-09-25T17:33:17.497 回答
0

Thanks to Loren Segal (Amazon) for his quick response. Refer https://github.com/aws/aws-sdk-js/issues/401 for more details. In short, the SDK is not retrying signature errors for which the work around is

AWS.events.on('retry', function(resp) {
  if (resp.error.code === 'SignatureDoesNotMatch') {
    resp.error.retryable = true;
  }
});

This is not a regression i.e, it is not a bug introduced in 2.0.23

于 2014-11-05T07:56:01.593 回答
0

很可能是您计算机上的时间不正确

签名不匹配是因为认证过程依赖于时钟同步。

检查您机器上的时间。

在 Linux / WSL 上,您可以运行sudo hwclock -s来修复。其他操作系统将需要不同的命令。

于 2021-06-10T10:54:52.350 回答