New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The vpce location constraint is incompatible for the region specific endpoint this request was sent #2858
Comments
Hi @vpeddada thank you for reaching out. This behavior is expected. According to the Javadocs:
|
Hi @debora-ito ! aws-sdk-java/aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/AmazonS3Client.java Line 1106 in 3309b35
This piece of code is retrieving the location as vpce instead of us-west-2 which has caused this issue. Hence there is an issue in aws-sdk-java/aws-java-sdk-core/src/main/java/com/amazonaws/util/AwsHostNameUtils.java Line 77 in 3309b35
After fetching the request region, the location constraint configuration is created in the following lines: aws-sdk-java/aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/AmazonS3Client.java Line 1114 in 3309b35
Please refer to the debug logs that I attached to this issue and you will find the Once I started providing region in the CreateBucketRequest, line no 1106 is skipped and the location constraint is rightly formed as us-west-2 and the operation was successful. |
Sorry I missed that part, I understand now. The workaround is to explicitly set the region in
As we have a workaround and the team is focused in SDK v2 work, fixing this is not high in our priority list. |
Hi @debora-ito ! Thank you for the acknowledgement. No problem. We made changes to accommodate the workaround. However, just wanted to check: |
@vpeddada Using AWS Cli and endpoint name I am able to create buckets properly. Also I am facing similar issue in doesBucketExistV2() |
Describe the bug
We are using a VPC endpoint for AWS S3 to create the S3 client followed by create Bucket
However, the operation faulted with the following error:
com.amazonaws.services.s3.model.AmazonS3Exception: The vpce location constraint is incompatible for the region specific endpoint this request was sent to.
After deeper investigation we found that there is an existing issue with LocationConstraint creation in the SDK which can be resolved by a workaround.
The LocationConstraint formed in the above case is an invalid region name and hence the operation failed.
You can refer to the attached logs.
Then we changed our code to use the region name too in the request as follows: This has resolved the issue
Expected Behavior
The createBucket operation should have worked with the older piece of code.
Current Behavior
However the operation failed with invalid location constraint error as the SDK has an issue with region parsing logic which tries to parse the region from the VPC endpoint if no location was mentioned in the CreateBucketRequest.
In our case we observed from the debug logs that it was formed as
<CreateBucketConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/"><LocationConstraint>vpce</LocationConstraint></CreateBucketConfiguration>
Here vpce is a string which is part of our VPC endpoint https://bucket.vpce-0ec9574cb6f757c5f-9i0g0rr9.s3.us-west-2.vpce.amazonaws.com:8020
Reproduction Steps
Possible Solution
We changed our code to use the region name too in the request as follows: This has resolved the issue
Please let us know if 1.12.x has resolved this issue.
Additional Information/Context
BW_S3_App3.txt
AWS Java SDK version used
1.11.967
JDK version used
1.8
Operating System and version
Windows 10
The text was updated successfully, but these errors were encountered: