martinklepsch / s3-beam

🚀 direct-to-S3 uploading using ClojureScript
Eclipse Public License 1.0
92 stars 17 forks source link

us-east-1 zone must be set to "s3" in server side configuration. #9

Closed ldenman closed 9 years ago

ldenman commented 9 years ago

Hi @martinklepsch, thanks for the useful tool. I just wanted to share a pain point getting it setup (spoiler it's just like #3).

In short, on S3, I created a bucket in us-east-1 w/ CORS configured, then configured my the server side according to the readme, except I configured my zone to be "s3-us-east-1" (which causes the issue), and then hooked up the client side. Everything worked up until the actual request to S3. My request was blocked each and every time. Fortunately, I found #3 which hinted to set the zone "s3" at which point the upload was successful.

To be clear, I attempted to use "us-east-1" and "s3-us-east-1" neither of which worked.

Working server side configuration for us-east-1:

(def bucket "xyzabc")
(def aws-zone "s3")
(def access-key "***")
(def secret-key "***")
...
(compojure/GET "/sign" {params :params} (s3b/s3-sign bucket aws-zone access-key secret-key))
...

I admit that I should have checked the closed issues earlier; I honestly thought it was my CORS configuration and definitely went down a rabbit hole. I haven't dug into the cause of this behavior but am curious whether this is a valid bug and if we might should mention it in the readme for the time being.

Here is output from the s3cmd to verify bucket location.

$ s3cmd info s3://foo
s3://foo/ (bucket):
   Location:  us-east-1
...

Thanks again!

martinklepsch commented 9 years ago

@ldenman hey, thanks for reporting! Any chance you can help me out with an error message or the like?

I'll try to look into this when I can.

ldenman commented 9 years ago

@martinklepsch Sure, I can try to come up with something.

Also, here is a table of all supported region->endpoint mappings: http://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region

martinklepsch commented 9 years ago

@ldenman thanks for that table, that's very helpful. A full error is probably no longer needed. :)

martinklepsch commented 9 years ago

I created a PR: #10. Does that look right to you? You can test locally by running lein install in the branch and using the version specified in the project.clj. Any feedback/review welcome :)

ldenman commented 9 years ago

Thanks @martinklepsch. I just took #10 for a test drive and it resolves this ticket. The code looks correct for each region as well. Closing this issue now.