-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Retry S3 uploads with different region when using signature V4. #697
Retry S3 uploads with different region when using signature V4. #697
Conversation
140b041
to
e2b2347
Compare
@@ -43,7 +43,8 @@ function extractError(resp) { | |||
if (data.Code) { | |||
resp.error = util.error(new Error(), { | |||
code: data.Code, | |||
message: data.Message | |||
message: data.Message, | |||
region: data.Region |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There shouldn't be any changes needed in this file since the extractError
in lib/services/s3.js will handle setting the region. This functionality is specific to S3 so would like to keep the logic contained there.
@rolftimmermans |
Thanks! I've addressed your comments. |
Retry S3 uploads with different region when using signature V4.
@rolftimmermans |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread. |
When uploading objects to S3 (or making other requests), it is possible to use the
us-east-1
region (the default) so that a region does not have to be specified. However, this fails with signature version v4 (which is required for some regions), because the region is included in theAuthorization
header.The returned error is
AuthorizationHeaderMalformed
. It actually contains the region the bucket is located in.This patch uses the
<Region>
element in the returned error to update the region to the suggested region in order to be able to retry the request. This ensures that it is always possible to omit the region when using S3 in combination with signature v4.