Cannot use aws_sdk_s3::Client::head_bucket()
to get bucket region without already knowing bucket region
#1052
Labels
bug
This issue is a bug.
service-api
This issue is due to a problem in a service API, not the SDK implementation.
Describe the bug
Consider the following program:
Dependencies:
When I run this program, passing the name of an S3 general-purpose bucket (which happens to be in
us-east-2
) as the argument, it fails with:If I call
region()
on theConfigLoader
(after the call tono_credentials()
) but use a region that the bucket argument is not in, the program fails with:The only way I can get the program to run successfully is to call
region()
with the name of the region the bucket is in, yet the whole point of the code is to determine what that region is.In contrast, if I just do
curl -fIsSL https://BUCKET_NAME.amazonaws.com
on the command line, the bucket's region is given in thex-amz-bucket-region
header, so it clearly shouldn't be hard for the SDK to get this information without the user having to set a region.Expected Behavior
The program should have successfully retrieved & output the region of the given S3 bucket without having to specify a region in the code.
Current Behavior
See above.
Reproduction Steps
See above.
Possible Solution
No response
Additional Information/Context
No response
Version
Environment details (OS name and version, etc.)
macOS Sonoma 14.2.1, Intel, rustc 1.75
Logs
No response
The text was updated successfully, but these errors were encountered: