Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/443.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/amazon-s3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/mercurial/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript JS AWS SDK-copyObject SignatureDesNotMatch错误_Javascript_Amazon S3_Aws Sdk - Fatal编程技术网

Javascript JS AWS SDK-copyObject SignatureDesNotMatch错误

Javascript JS AWS SDK-copyObject SignatureDesNotMatch错误,javascript,amazon-s3,aws-sdk,Javascript,Amazon S3,Aws Sdk,我有一个使用Node和包的应用程序。我使用该方法将对象从一个bucket复制到另一个bucket。我收到一个错误,上面写着signaturedesnotmatch:我们计算的请求签名与您提供的签名不匹配。检查您的密钥和签名方法。 我已经能够在我的本地机器上成功地运行代码,它将文件从一个bucket复制到另一个bucket。错误发生在我部署应用程序的AWS服务器上。完全错误是: { [SignatureDoesNotMatch: The request signature we calculate

我有一个使用Node和包的应用程序。我使用该方法将对象从一个bucket复制到另一个bucket。我收到一个错误,上面写着
signaturedesnotmatch:我们计算的请求签名与您提供的签名不匹配。检查您的密钥和签名方法。

我已经能够在我的本地机器上成功地运行代码,它将文件从一个bucket复制到另一个bucket。错误发生在我部署应用程序的AWS服务器上。完全错误是:

{ [SignatureDoesNotMatch: The request signature we calculated does not 
match the signature you provided. Check your key and signing method.]
message: 'The request signature we calculated does not match the signature you provided. Check your key and signing method.',
code: 'SignatureDoesNotMatch',
region: null,
time: Mon Jul 11 2016 12:11:36 GMT-0400 (EDT),
requestId: <requestId>,
extendedRequestId: <extendedRequestId>,
cfId: undefined,
statusCode: 403,
retryable: false,
retryDelay: 66.48076744750142 }
AWS.config.update({
  accessKeyId: <accessKeyId>,
  secretAccessKey: <secretAccessKey>,
  correctClockSkew: true
});
var s3 = new AWS.S3();
var params = {
  Bucket: <bucket>,
  Prefix: <prefix>
};

s3.listObjects(params, function(err, data) {
  if (data.Contents.length) {
    async.each(data.Contents, function(file, cb) {
      var file_name = file.Key.substr(file.Key.indexOf('/')+1);
      var copy_params = {
        Bucket: <bucket2>,
        CopySource: <bucket> + '/' + file.Key,
        Key: file_name,
        ACL: 'public-read'
      };

      s3.copyObject(copy_params, function(copyErr, copyData){
        if (copyErr) {
          console.log('Error:', copyErr);
        }
        else {
          cb();
        }
      });
    }, function(err){
        ...
      }
    });
  } else {
    ...
  }
});