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

Provide user-friendly error when S3 bucket is in a different region #171

Closed
holyjak opened this issue Jan 25, 2021 · 2 comments
Closed

Provide user-friendly error when S3 bucket is in a different region #171

holyjak opened this issue Jan 25, 2021 · 2 comments

Comments

@holyjak
Copy link

holyjak commented Jan 25, 2021

Hello! It would be awesome if aws-api provided a user-friendly error for the problem described here https://github.com/cognitect-labs/aws-api#invalid-location-header-null

I imagine there is a number of users that wasted lot of time troubleshooting this, who did not thought of checking the Readme for the error. So catching it and returning something easier to understand (such as "The target bucket is in a different region then the client's eu-west-1. Create a client for the same region.").

It would be better if AWS got their act together and returned a sensible error but I am afraid they are not as flexible as we need :)

@pieterbreed
Copy link

users that wasted lot of time ...

👍

This issue cropped up for me during fetching of s3 maven dependencies with deps.edn and clojure cli.

We created an s3 bucket for a private maven repository in eu-west-1 and updated the :mvn/repos value to include this s3 url. We also have a dependency on datomic and cognitect artifacts, which are on an s3 bucket in us-east-1. I think there is some kind of conflict here when s3 maven repos are not in the same region, when downloading artifacts with deps.edn.

Workaround for us was to create a new bucket in us-east-1.

@dchelimsky
Copy link
Contributor

0.8.64 upgrades to the latest com.cognitect/http-client, which includes headers and status in the anomaly:

{:status 301,
 :headers {"x-amz-bucket-region" "us-east-1"}}

So now you can detect the 301 and then re-send the request to the correct region. We'll probably automate eventually, but, for now, at least you have the information you need to take corrective action programmatically.

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