-
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
SDK client overrides region settings for custom s3api endpoint #3935
Comments
Hi, is this bug still persisting with the latest version of SDK? |
This issue has not received a response in 1 week. If you want to keep this issue open, please just leave a comment below and auto-close will be canceled. |
Was it fixed? |
Our workaround for the issue: req, _ := svc.CreateBucketRequest(&s3.CreateBucketInput{
Bucket: &bucketName,
CreateBucketConfiguration: bucketConf,
})
// removes "populateLocationConstraint" handler from aws/aws-sdk-go/service/s3/bucket_location.go
req.Handlers.Validate.RemoveByName("__anonymous") |
Can you confirm if this is still persisting with the latest version of SDK? |
@vudh1 the bug still persists |
Thanks for the update @kayrus. I'm attempting to reproduce the issue described where setting a custom In addition removal of the
With regard to this error message you're seeing when explicitly setting The following is the code that I'm using to try to reproduce the issue, but I'm seeing the configured package main
import (
"fmt"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3"
)
func main() {
sess, err := session.NewSession(&aws.Config{
Region: aws.String("my-custom-region"),
Endpoint: aws.String("https://my-endpoint"),
S3ForcePathStyle: aws.Bool(true),
LogLevel: aws.LogLevel(aws.LogDebugWithHTTPBody | aws.LogDebugWithSigning),
MaxRetries: aws.Int(0),
})
if err != nil {
panic(err)
}
client := s3.New(sess)
result, err := client.CreateBucket(&s3.CreateBucketInput{
Bucket: aws.String("my-bucket"),
CreateBucketConfiguration: &s3.CreateBucketConfiguration{
LocationConstraint: aws.String("us-west-2"),
},
})
fmt.Println(result, err)
} Example output.
|
In the original message you can see:
it also visible in the code: aws-sdk-go/service/s3/bucket_location.go Lines 97 to 106 in 32d9e06
If the region doesn't correspond to |
Given that there isn't a reasonably or infallible way to determine what is or isn't a custom API endpoint there isn't really a specific action we can do here without creating a breaking change. If you are using the SDK to talk to a third-party S3 API implementation then you can could remove this request handler on the request like so: req.Handlers.Unmarshal.Remove(s3.NormalizeBucketLocationHandler) |
@skmcgrail you're mixing up two things: normalize handler (which actually has a handler name) and |
Hi there, This is quite old and will not get fixed in v1. If this is still an issue on AWS SDK Go v2, please feel free to open a separate issue on the v2 repo Thanks, |
Comments on closed issues are hard for our team to see. |
Confirm by changing [ ] to [x] below to ensure that it's a bug:
Describe the bug
When using custom api endpoint, with a set of none-AWS regions, SDK client overrides this regions, blocking us from making the request.
Version of AWS SDK for Go?
v1.38.3
Version of Go (
go version
)?go1. 16
To Reproduce (observed behavior)
aws-sdk-go/service/s3/bucket_location.go
Line 97 in bba6aba
Expected behavior
We want the client not to change our region configuration, meaning he will pass it on without modifying it.
Additional context
As a workaround, we used this code:
if false && r.ParamsFilled() && aws.StringValue(r.Config.Region) != "us-east-1" {
which keeps the client in the same region as it configured.
we opened an issue #3906 and got this answer:
Try setting the CreateBucketConfiguration member of CreateBucketInput.
and then the issue was closed, but we did try using this solution, even before we got the answer, and it did'nt work, gave us this error:
Error: failed to create "--bucketname--" bucket: AuthorizationHeaderMalformed: The authorization header is malformed; the region 'us-east-1' is wrong; expecting 'us-west-2'
The text was updated successfully, but these errors were encountered: