lusingander / stu

TUI explorer application for Amazon S3 (AWS S3) 🪣
https://lusingander.github.io/stu/
MIT License
155 stars 7 forks source link

Region is not loaded from AWS config #23

Closed williamdes closed 4 days ago

williamdes commented 1 week ago

.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 commented 1 week ago

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

lusingander commented 1 week ago

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.

williamdes commented 6 days ago

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 commented 5 days ago

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 https://github.com/lusingander/stu/blob/b4725cbd2901a4a27d79829c9c31afbd94f72924/src/client.rs#L123

Only needs to fix region loading now ?

lusingander commented 5 days ago

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 commented 4 days ago

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 commented 3 days ago

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

williamdes commented 20 hours ago

Thank you ! It works fine 🎉

lusingander commented 20 hours ago

Thanks for checking!