copyObject: what does a 200 status but failed operation look like?

0

Our team is using the AWSJavaScriptSDK. According to the documentation https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html#copyObject-property:

A copy request might return an error when Amazon S3 receives the copy request or 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. Design your application to parse the contents of the response and handle it appropriately

However, no example is given of what that failure might look like, and the types associated with copyObject in the TypeScript file of the aws-sdk Node library (i.e. CopyObjectResult and S3.Types.CopyObjectOutput) suggest that there isn't a place for a failed copy to be reported in a success response.

Does anyone know how to interpret this documentation? What is an example of a copy operation failing while returning a 200 OK to copyObject, and how would the caller know?

Edited by: Mark T Tomczak on Apr 19, 2020 9:08 AM

Edited by: Mark T Tomczak on Apr 19, 2020 9:08 AM

Edited by: Mark T Tomczak on Apr 19, 2020 9:09 AM

질문됨 4년 전438회 조회
1개 답변
0

Got bored, spelunked in the source code of the library itself, found the answer to my own question. ;)

The SDK itself massages 200 status OK responses into errors for specific API calls, including copyObject.

As of this commit[1] , the operations completeMultipartUpload, copyObject, and uploadPartCopy are flagged[2] as able to return a status code 200 that is actually an error, and there is a handler[3] to coerce those responses into error responses.

[1]: https://github.com/aws/aws-sdk-js/commit/347f2d9b11deea1fd09bff960245801d47edbd5c
[2]: https://github.com/aws/aws-sdk-js/blob/dfb49100f7db707a2479726f911ca31443f5a861/lib/services/s3.js#L13-L15
[3]: https://github.com/aws/aws-sdk-js/blob/dfb49100f7db707a2479726f911ca31443f5a861/lib/services/s3.js#L652

답변함 4년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠