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

s3: Force setting region always in AWS session #333

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mattrobenolt
Copy link
Contributor

I describe the problem in comment in code, but tl;dr is when using ?aws_profile=xxx method, we never set region on the AWS session unless it's defined in the profile itself. This is incorrect behavior since buckets exist in different regions than your profile and are explicitly defined anyways.

Without this, in my case, I was getting a MissingRegion error when calling client.GetObject().

// location, so we need to override and explicitly bind what region we're
// intending based on the bucket location otherwise it's possible to get
// a MissingRegion error.
if region != "" {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't want to make this change since I didn't look that deep, but I think we can avoid this check entirely since afaict, this value will always be something. Any detection of region that gets passed in here comes through at least with a fallback of us-east-1 when there's no region defined in the url itself. But I kept it since it existed in getAWSConfig before.

@hashicorp-cla
Copy link

hashicorp-cla commented Mar 12, 2022

CLA assistant check
All committers have signed the CLA.

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

Successfully merging this pull request may close these issues.

2 participants