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

Fog gives wrong location for buckets when connected via non-default region #208

Closed
jamesremuscat opened this issue Dec 10, 2015 · 2 comments

Comments

@jamesremuscat
Copy link
Contributor

In this example, the bucket "jrem-test" has been created in the us-east-1 region.

>> Fog::Storage.new({provider: "AWS", region: "us-east-1"}).directories.get("jrem-test").location
"us-east-1"

as you'd expect. However, connecting via another region gives a different answer:

Fog::Storage.new({provider: "AWS", region: "eu-west-1"}).directories.get("jrem-test").location
[fog][WARNING] fog: followed redirect to jrem-test.s3-eu-west-1.amazonaws.com, connecting to the matching region will be more performant
"eu-west-1"

(Some operations on the bucket using the latter connection work fine, but (for example) directory.files.all throws an error complaining that the wrong region was used; creating some new objects fails with an error that suggests Fog isn't following redirects correctly - which is probably another issue).

I think the problem lies in lib/fog/aws/models/storage/directory.rb:34, where if no location constraint is set on an object, the region of the connection is used. I think this should instead use the AWS default region.

@geemus
Copy link
Member

geemus commented Dec 21, 2015

Redirect following is definitely not working right, we probably need to change it to do more requests to figure things out properly. Maybe falling back to default is the better choice here, would you be up for working on a related pull request?

@geemus
Copy link
Member

geemus commented Jan 4, 2016

Fixed by #211

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

2 participants