-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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:GetBucketLocation throwing error #380
Comments
Hi @jitcompile thanks for reporting this issue. When you encountered this issue, was the region specified as us-east-1? In addition was the Config.Endpoint value set for this operation request? I'm trying to reproduce the issue you're seeing with the below code, but it's coming back with the correct response. If you could add your configuration, and even better HTTP body output like in the following sample it would be very helpful. package main
import (
"fmt"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/s3"
)
func main() {
svc := s3.New(aws.NewConfig().
WithLogLevel(aws.LogDebugWithHTTPBody).
WithRegion("us-east-1"))
res, err := svc.GetBucketLocation(&s3.GetBucketLocationInput{
Bucket: aws.String("bucket-thats-in-ap-southeast-1"),
})
fmt.Println(res, err)
} |
Hi @jasdel, I've tried to log the http body and here's the printed message. The last line is from my own logging where I log the *aws.config.region value to screen.
|
Thanks for the extra information. I think I figured this problem out. The GetBucketLocation should be using the S3 path style where the bucket name is apart of the URI path instead of host. A workaround you can use until this is fixed is in your Config enable svc := s3.New(aws.NewConfig().
WithS3ForcePathStyle(true) or svc := s3.New(&aws.Config{S3ForcePathStyle: aws.Bool(true)}) |
Thanks @jasdel for confirming the problem and the workaround. I've a ugly hack in my code where I'm parsing the error using regex and getting the correct bucket location. I'll use the workaround that you suggested. I'll wait for the final fix. Thank you and fantastic work with the sdk 👍 |
Hi @jitcompile This bug was fixed in the SDK's latest release. If you sync with it you'll be able to use GetBucketLocation without setting the |
Calling S3.GetBucketLocation with a bucket name throws the following error. Ideally the exception should be caught, processed and the information shown as LocationConstraint output field.
AuthorizationHeaderMalformed: The authorization header is malformed; the region 'us-east-1' is wrong; expecting 'ap-southeast-2' status code: 400, request id:
The text was updated successfully, but these errors were encountered: