Getting the following error when trying to use the copyObject command (AWS S3). I'm using the AWS PHP SDK, and here is the code:
$this->client->copyObject(array(
'Bucket' => 'lms-courses',
'Key' => 'ideasfile.zip',
'CopySource' => "lms-courses/lalala.zip",
));
Error executing "CopyObject" on "https://s3-us-west-2.amazonaws.com/lms-courses/ideasfile.zip"; AWS HTTP error: Client error:
PUT https://s3-us-west-2.amazonaws.com/lms-courses/ideasfile.zip
resulted in a404 Not Found
response:NoSuchKey
The specified key does not exist.lalala.zipE698888 (truncated...) NoSuchKey (client): The specified key does not exist. -NoSuchKey
The specified key does not exist.lalala.zipE698888912B810F7DfHtqN5Hls4hGdTGY/pVv36XZPzoM4mJ5fAdhJjEjDufNUArvKCrqN27SjiG06u5hnC8G8yPdzA=
I've been struggling with this error for awhile now. The bucket lms-courses
exists, and so does ideasfile.zip
. I even manually added that file into the bucket, just to test it out that way - in case that it didn't upload properly or something.
I don't get why it says that the key does not exist, when it clearly does - I am looking at it.
The error says the source object lalala.zip
does not exist. Are you sure lms-courses/lalala.zip
exists?
According to Copy an Object Using the AWS SDK for PHP
// Copy an object.
$s3->copyObject(array(
'Bucket' => $targetBucket,
'Key' => $targetKeyname,
'CopySource' => "{$sourceBucket}/{$sourceKeyname}",
));