Handle case where S3 returns a 200 error response #298
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
From http://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectCOPY.html:
There are two opportunities for a copy request to return an error. One
can occur when Amazon S3 receives the copy request and the other can
occur while Amazon S3 is copying the files. If the error occurs before
the copy operation starts, you receive a standard Amazon S3 error. If the
error occurs during the copy operation, the error response is embedded in
the 200 OK response. This means that a 200 OK response can contain either
a success or an error. Make sure to design your application to parse the
contents of the response and handle it appropriately.
Operations that need this behavior:
The fix here is to switch the status code to 500, because, for all
intents and purposes, this is an error response. This ensures it
goes through our normal 5xx retry logic and exception handling/raising
code.
cc @danielgtaylor