AmazonError:我们计算出的请求签名与您提供的签名不匹配

时间:2018-07-27 07:33:35

标签: node.js database amazon-web-services amazon-dynamodb

我正在尝试连接到AWS服务器,并且从dynamo DB connect得到此错误。

代码是这样的。

vuaws.dbclient().getItem('users', usrname, opts, function(err, data) {
      if (err || !data) {
        vulog.error('ddb: error in finding user \n',err);
      } else {
        vulog.debug('user got from db: ');

数据库客户端就是这样的功能。

  dbclient: function() {
    return dynode;
  },

参数是这个。

users admin@gmail.com { ConsistentRead: true,
  AttributesToGet: [ 'role', 'password' ] }

我收到的完整错误是这样的。

{ AmazonError: The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details.
    at IncomingMessage.<anonymous> (/home/evbooth/Desktop/hirekwick/node_modules/dynode/lib/dynode/request.js:57:19)
    at emitNone (events.js:111:20)
    at IncomingMessage.emit (events.js:208:7)
    at endReadableNT (_stream_readable.js:1064:12)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickDomainCallback (internal/process/next_tick.js:218:9)
  type: 'InvalidSignatureException',
  serviceName: 'com.amazon.coral.service',
  message: 'The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details.',
  statusCode: 400,
  action: 'GetItem',
  retry: [Getter] }
vuaws.js中的

dynamodb以此方式定义。

  dynode.auth(vuconst.dynodeauth);
    vulog.info('dynode.attached');
    var dynamodb = new AWS.DynamoDB();
    vulog.info('dynamodb connected:');
  

vuconst.dynodeauth

是这样的。

dynodeauth: {
    "accessKeyId": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    "secretAccessKey": "xxxxxxxxxxxxxxxxxxxxxxxxxxx",
    "region": "us-west-2"
  },

有帮助吗?

1 个答案:

答案 0 :(得分:0)

当我在aws-cli和程序中的其他凭据中使用其他凭据时,曾发生此错误。只需从aws-cli注销即可。