kmansoor
kmansoor

Reputation: 4345

AWS S3 node sdk copyObject NoSuchKey error

Update I think this may be because of not waiting for Elastic Trnscoder to finish the job.

I have an Amazon Elastic Transcoder job initiated by a lambda. I can see the transcoded file in the "out" bucket. I am trying to copy this transcoded file to another bucket, like so:

let copyParams = {
 Bucket: "hurontg.video.out.1", 
 CopySource: "hurontg.x3482.video.out/58759ab51e57_transcoded‌​.mp4", // bucket/file exists 
 Key: "58759ab51e57.mp4"
};

 s3.copyObject(copyParams, function(err, data) {
  if (err) {
   console.log(err, err.stack);
  } else {

  }
)};

This results in:

NoSuchKey: The specified key does not exist.

As mentioned earlier, I can verify that the source bucket and file exist. Not sure what this error means as the Key should be created in the destination bucket?

Upvotes: 4

Views: 3015

Answers (1)

jonnocraig
jonnocraig

Reputation: 597

You need to ensure the CopySource is url encoded e.g. CopySource: encodeURIComponent("hurontg.x3482.video.out/58759ab51e57_transcoded‌​.mp4"),.

More detail here: https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html#copyObject-property

Upvotes: 1

Related Questions