Skip to content
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

Create bucket with region "us-east-1" return error #222

Closed
zentechtungtran opened this issue Sep 21, 2016 · 4 comments
Closed

Create bucket with region "us-east-1" return error #222

zentechtungtran opened this issue Sep 21, 2016 · 4 comments

Comments

@zentechtungtran
Copy link

zentechtungtran commented Sep 21, 2016

when using ExAws.S3.put_bucket/3, with the region "us-east-1", the response is always
{:error, {:http_error, 400, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Error><Code>InvalidLocationConstraint</Code><Message>The specified location-constraint is not valid</Message><LocationConstraint></LocationConstraint></Error>"
I read that with "us-east-1" region, the "LocationConstraint" element is not necessary, then may be in ex_aws/s3.ex file line 269, default case should be handled.
I'm using {:ex_aws, "~> 1.0.0-beta0"}
I attached 2 requests debug info here, they all return the same error.

1/ [debug] Request URL: "https://s3.amazonaws.com/testabcd/"
[debug] Request BODY: "<CreateBucketConfiguration xmlns=\"http://s3.amazonaws.com/doc/2006-03-01/\">\n <LocationConstraint></LocationConstraint>\n</CreateBucketConfiguration>\n"

2/[debug] Request URL: "https://s3.amazonaws.com/testabcd/"
[debug] Request BODY: "<CreateBucketConfiguration xmlns=\"http://s3.amazonaws.com/doc/2006-03-01/\">\n <LocationConstraint>us-east-1</LocationConstraint>\n</CreateBucketConfiguration>\n"

@benwilson512
Copy link
Contributor

Can you gist the code you're running to create this request?

@dobryakov
Copy link

I think it is not only this project's problem:
boto/boto3#125
https://github.com/SaltwaterC/aws2js/issues/64

@benwilson512
Copy link
Contributor

Yeah basically you want to do put_bucket("bucket_name", ""). However, I should probably handle making "us-east-1" produce an empty string location constraint.

This is a great case of one of the things that makes me rant about how badly designed the S3 API is.

@benwilson512
Copy link
Contributor

Fixed on master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants