aws-sdk-cpp icon indicating copy to clipboard operation
aws-sdk-cpp copied to clipboard

Aws::S3::S3Client::HeadObject/GetObject not working with S3 Object lambda ARN endpoint for S3 CPP SDK

Open johnugeorge opened this issue 2 years ago • 1 comments

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 avatar Apr 26 '22 13:04 johnugeorge

@johnugeorge thanks for reaching out. This is reproducible from my side. We will investigate this case more, and give you an update.

vudh1 avatar May 16 '22 18:05 vudh1

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.

jmklix avatar Jan 13 '24 01:01 jmklix