aws-sdk-cpp
aws-sdk-cpp copied to clipboard
Aws::S3::S3Client::HeadObject/GetObject not working with S3 Object lambda ARN endpoint for S3 CPP SDK
Describe the bug
With AWS S3 CPP SDK, when HeadObject/GetObject API is used with Object lambda endpoint, it fails with error "Path style addressing is not compatible with Access Point ARN or Outposts ARN in Bucket field, please consider using virtual addressing for this client instead. "
However, same ARN works with head_object api of S3 python boto3 SDK.
Expected Behavior
Consistent behaviour is expected. S3 CPP SDK should work for Object lambda Access ARN also.
Current Behavior
AWS SDK CPP Head Objects and GetObjects don't work with S3 Object lambda access point. But, it works with python boto3 sdk.
Reproduction Steps
CPP(doesn't work)
std::string b{"arn:aws:s3-object-lambda:ap-south-1:<account-id>:accesspoint/test-lambda"};
Aws::String bucket(b.c_str(), b.size());
std::string o{"a.txt"};
Aws::String object(o.c_str(), o.size());
Aws::S3::Model::HeadObjectRequest head_object_request;
head_object_request.WithBucket(bucket).WithKey(object);
head_object_request.SetResponseStreamFactory(
[]() { return Aws::New<Aws::StringStream>(TAG); });
auto head_object_outcome =
s3_file->s3_client->HeadObject(head_object_request);
if !(head_object_outcome.IsSuccess()) {
//print head_object_outcome.GetError().GetMessage().c_str())
}
Python(works)
response = s3.head_object(Bucket='arn:aws:s3-object-lambda:ap-south-1:<account-id>:accesspoint/test-lambda', Key='a.txt')
Possible Solution
No response
Additional Information/Context
No response
AWS CPP SDK version used
1.8.186
Compiler and Version used
Apple clang version 12.0.5
Operating System and version
MacOS 12.3.1
@johnugeorge thanks for reaching out. This is reproducible from my side. We will investigate this case more, and give you an update.
This should be fixed in the latest version of this sdk with endpoints 2.0 update. If that still doesn't work for you please let me know.