-
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
TemporaryRedirect on recently created bucket #1267
Comments
Thanks for contacting us @kr Out of curiosity is your code attempting to put to the bucket as soon as the The SDK provides the sess := session.Must(session.NewSession())
svc := s3.New(sess, &aws.Config{Region: aws.String(myRegion)})
// Create the bucket
resp, err := svc.CreateBucket(&CreateBucketInput{
Bucket: aws.String(myBucket),
})
// Wait until bucket is setup and ready to use before using it.
err = svc.WaitUntilBucketExists(&s3.HeadBucket{
Bucket: aws.String(myBucket),
})
// Now the bucket is ready to use. |
No, I created the bucket manually on the AWS console, then a few minutes later attempted to put an object into it. As I mentioned, putting an object on the console or with the CLI worked fine, but subsequent attempts to put an object using the AWS Go SDK still failed over the course of many minutes. I tried the same PUT call on the same bucket with the Go SDK again the next day (today) and it worked. |
Thanks for the update and clarification @kr. Are you only creating the bucket via the AWS console? Then attempting to upload to it from the SDK, or CLI? I've not experienced this issue before. I'll try to reproduce this. What region are you using when creating the bucket? Does this happen every time a new bucket is created, or only some fraction of the time? |
So after a bit of investigation the redirect issue looks to be a known condition of creating buckets outside of the The SDK's http client will not follow this 307 redirect because the method is a |
Updating this to a bug since the SDK should definitely support these redirects, and there isn't really a good way to work around this issue. |
Adds support for Go 1.8's GetBody function allowing the SDK's http request using PUT and POST methods to be redirected with temporary redirects with 307 status code. Fix #1267
Thanks for reporting this issue @kr I've updated the SDK to enable support for retrying PUT requests that are redirected. This should resolve the errors that you are seeing. Let us know if you run into any additional issues, or have feedback. |
Awesome, thank you so much! (It looks like you don't need the RequestID, but in case you ever do for whatever reason, there's one in my original message above. And yep, I was/am using Go 1.8.) |
Thanks for verifying this corrects the redirect you were running into. |
Fixes the Travis CI tests to allow the tests targeting Go tip to fail.
Version of AWS SDK for Go?
Version of Go (
go version
)?What issue did you see?
On a recently created bucket:
This bucket operates normally on the AWS console and via the AWS CLI. Of the things I've tried, only the AWS Go SDK is returning this error.
Steps to reproduce
Create a bucket and then call
PutObjectWithContext
.The text was updated successfully, but these errors were encountered: