使用 AWS S3 CopyObject 命令时不断获取未找到的密钥

Keep getting key not found when using AWS S3 CopyObject command

尝试使用 copyObject 命令 (AWS S3) 时出现以下错误。我正在使用 AWS PHP SDK,代码如下:

$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 a 404 Not Found response: NoSuchKeyThe specified key does not exist.lalala.zipE698888 (truncated...) NoSuchKey (client): The specified key does not exist. - NoSuchKeyThe specified key does not exist.lalala.zipE698888912B810F7DfHtqN5Hls4hGdTGY/pVv36XZPzoM4mJ5fAdhJjEjDufNUArvKCrqN27SjiG06u5hnC8G8yPdzA=

我已经为这个错误苦苦挣扎了一段时间。存储桶 lms-courses 存在,ideasfile.zip 也存在。我什至手动将该文件添加到存储桶中,只是为了以这种方式对其进行测试 - 以防它未正确上传或发生其他问题。

我不明白为什么它说密钥不存在,而它显然存在 - 我正在查看它。

错误提示源对象 lalala.zip 不存在。您确定 lms-courses/lalala.zip 存在吗?

根据Copy an Object Using the AWS SDK for PHP

// Copy an object.
$s3->copyObject(array(
    'Bucket'     => $targetBucket,
    'Key'        => $targetKeyname,
    'CopySource' => "{$sourceBucket}/{$sourceKeyname}",
));