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

Region is not loaded from AWS config #23

Closed
williamdes opened this issue Sep 8, 2024 · 9 comments · Fixed by #28
Closed

Region is not loaded from AWS config #23

williamdes opened this issue Sep 8, 2024 · 9 comments · Fixed by #28
Labels
bug Something isn't working

Comments

@williamdes
Copy link

williamdes commented Sep 8, 2024

.aws/config

[profile myprofile]
region = garage
services = garage
endpoint_url = http://x.x.x.x:3900

[services garage]
s3 =
  endpoint_url = http://x.x.x.x:3900

Running: stu --profile myprofile it does not use the region but ap-northeast-1. Checked in debug log.

Maybe it is only the unexpected scope: ?

<?xml version=\"1.0\" encoding=\"UTF-8\"?><Error><Code>AuthorizationHeaderMalformed</Code><Message>Authorization header malformed, unexpected scope: 20240908/ap-northeast-1/s3/aws4_request</Message><Resource>/</Resource><Region>garage</Region></Error>

That said passing --region garage makes it work

@lusingander
Copy link
Owner

Thanks for reporting, it certainly does seem to not be loading 😕

@lusingander
Copy link
Owner

lusingander commented Sep 9, 2024

I would expect it to be loaded by the Default Region Provider, but it doesn't seem to be loaded. At least it seems to be loaded when specified by the environment variable AWS_REGION.

Also, although this is a separate this, it might be better to be able to set DEFAULT_REGION.

@lusingander lusingander added the bug Something isn't working label Sep 9, 2024
@williamdes
Copy link
Author

Thank you for looking into it
ap-northeast-1/s3/aws4_request</Message><Resource>/</Resource><Region>garage
Shows some part of the code knows the region and another part does not, this is quite an interesting bug

@williamdes
Copy link
Author

williamdes commented Sep 11, 2024

The new version of stu (0.6.0) now does a better error message: No bucket found (region: us-east-1) with stu --profile mail-server-wdes-intranet
Probably

"us-east-1".to_string()

Only needs to fix region loading now ?

@lusingander
Copy link
Owner

lusingander commented Sep 11, 2024

The implementation up to 0.5.2 was as follows:

  1. If --region is set, use it.
  2. If AWS default value (environment variable, profile, etc.) is set, use it.
  3. If none of them can be obtained, use the default value (ap-northeast-1).

In 0.6.0, users can now set the default value of 3 individually as a configuration.

On the other hand, this issue is about the profile value not being loaded correctly in 2.

Setting a default value may save you the trouble of specifying --region.

@evanofslack
Copy link

I am also seeing the issue, I would have expected the region from my aws profile to be used, but I have to specify it manually. Following.

@lusingander
Copy link
Owner

https://github.com/lusingander/stu/releases/tag/v0.6.2

@williamdes
Copy link
Author

Thank you !
It works fine 🎉

@lusingander
Copy link
Owner

Thanks for checking!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants