Closed
Description
Describe the bug
Ubuntu 22.04, GCC 11.2, aws-sdk-cpp 1.9.22 (from vcpkg)
This code (excerpt);
Aws::S3::Model::CopyObjectRequest copyObjectRequest;
auto outcome = s3Client.CopyObject(copyObjectRequest
.WithCopySource("558007041168/Wedding/lenovelle.jpg?versionId=zm1uOxum.DfrtaVE9opSLgR21orgDN0L")
.WithBucket("558007041168")
.WithKey("Wedding/lenovelle1.jpg"));
fails with exception NoSuchKey
- The specified key does not exist
Log shows:
[DEBUG] 2022-09-21 19:44:41.290 AWSAuthV4Signer [139753200830464] Canonical Request String: PUT
/Wedding/lenovelle1.jpg
amz-sdk-invocation-id:04F1939E-F0A3-4FD6-BB21-433DB8DA03BA
amz-sdk-request:attempt=1
content-length:0
content-type:application/xml
host:558007041168.s3.eu-central-1.amazonaws.com
x-amz-api-version:2006-03-01
x-amz-content-sha256:UNSIGNED-PAYLOAD
x-amz-copy-source:558007041168/Wedding/lenovelle.jpg%3FversionId%3Dzm1uOxum.DfrtaVE9opSLgR21orgDN0L
x-amz-date:20220921T194441Z
Note how x-amz-copy-source
was encoded.
Expected Behavior
No exception.
Current Behavior
Exception NoSuchKey
- The specified key does not exist
From the logs:
<Error><Code>NoSuchKey</Code><Message>The specified key does not exist.</Message><Key>Wedding/lenovelle.jpg?versionId=zm1uOxum.DfrtaVE9opSLgR21orgDN0L</Key><RequestId>QG9XH4MMABAZ0858</RequestId><HostId>TXkprRHfwnOHZM3JonCZbOeoNe9WJM+5jAIXSiB1pD1CdCdHGrli3HTi/ZZVPlj+fjiOATeHkGA=</HostId></Error>
Reproduction Steps
#include <iostream>
#include <aws/core/Aws.h>
#include <aws/core/utils/logging/DefaultLogSystem.h>
#include <aws/core/utils/logging/AWSLogging.h>
#include <aws/s3/S3Client.h>
#include <aws/s3/model/CopyObjectRequest.h>
int main()
{
Aws::SDKOptions options;
Aws::InitAPI(options);
{
Aws::Utils::Logging::InitializeAWSLogging(
Aws::MakeShared<Aws::Utils::Logging::DefaultLogSystem>("s3copy", Aws::Utils::Logging::LogLevel::Debug, "s3copy-"));
Aws::Client::ClientConfiguration clientConfiguration;
clientConfiguration.region = "eu-central-1";
Aws::S3::S3Client s3Client(clientConfiguration);
Aws::S3::Model::CopyObjectRequest copyObjectRequest;
auto outcome = s3Client.CopyObject(copyObjectRequest
.WithCopySource("558007041168/Wedding/lenovelle.jpg?versionId=zm1uOxum.DfrtaVE9opSLgR21orgDN0L")
.WithBucket("558007041168")
.WithKey("Wedding/lenovelle1.jpg"));
if (outcome.IsSuccess()) {
std::cout << "Copied\n";
}
else {
std::cout << "CopyObject error: "
<< outcome.GetError().GetExceptionName() << " - "
<< outcome.GetError().GetMessage() << std::endl;
}
Aws::Utils::Logging::ShutdownAWSLogging();
}
Aws::ShutdownAPI(options);
return 0;
}
Possible Solution
No response
Additional Information/Context
No response
AWS CPP SDK version used
1.9.22 (vcpkg)
Compiler and Version used
gcc 11.2
Operating System and version
Ubuntu 22.04
Metadata
Metadata
Assignees
Labels
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
josuegomes commentedon Sep 21, 2022
For reference the same request using AWS CLI:
aws s3api copy-object --debug --copy-source 558007041168/Wedding/lenovelle.jpg?versionId=zm1uOxum.DfrtaVE9opSLgR21orgDN0L --bucket 558007041168 --key Wedding/lenovelle1.jpg
Logs this:
jmklix commentedon Sep 22, 2022
I'm getting the exact same error on Mac. Looking into the cause of this
jmklix commentedon Feb 6, 2024
This is fixed with this PR: #2564
1 remaining item