Documentation on the S3.copyObject method in AWSJavaScriptSDK indicates the following:
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 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?
You are working with the S3 API and receive an error: 409 Conflict. What is a possible cause of this error? You're attempting to delete a bucket without first removing the contents in the bucket. Explanation: A 409 HTTP Status Code can indicate a BucketNotEmpty error code.
If an object already exists in a bucket, the new object will overwrite it because Amazon S3 stores the last write request.
HTTP 200 code indicates a successful write to S3.
Amazon's S3 will occasionally fail with errors during uploads or downloads -- generally "500: Internal Server" errors.
The CopyObject operation creates a copy of a file that is already stored in S3. When we tried using it, we consistently got the S3 error AccessDenied: Access Denied.
You can't copy an object from the Amazon S3 Glacier storage class. You must first restore the object from Amazon S3 Glacier before you can copy the object. For instructions, see How do I restore an S3 object that has been archived?
For example, to copy a specific version of an object, you need the permission for s3:GetObjectVersion in addition to s3:GetObject. If you're copying objects that have object tags, then your IAM identity must have s3:GetObjectTagging and s3:PutObjectTagging permissions.
Amazon S3 supports copy operations using access points only when the source and destination buckets are in the same AWS Region. Alternatively, for objects accessed through Amazon S3 on Outposts, specify the ARN of the object as accessed in the format arn:aws:s3-outposts:<Region>:<account-id>:outpost/<outpost-id>/object/<key>.
The SDK itself massages 200 status OK responses into errors for specific API calls, including copyObject.
As of this commit , the operations completeMultipartUpload
, copyObject
, and uploadPartCopy
are flagged as able to return a status code 200 that is actually an error, and there is a handler to coerce those responses into error responses.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With