Error message when calling AmazonS3Client.CompleteMultipartUpload

0

When calling AmazonS3Client.CompleteMultipartUpload() method like this:

var cmp = new CompleteMultipartUploadRequest
{
    BucketName = _s3settings.BucketName,
    Key = "d2dae7c6-6809-4963-9daf-55d5b66ef777",
    UploadId = "uqZ.GW2U2gOIR3YtxY6jXSNNmjtS5u54hijmklrvbo.Fg.B86rsp2ffw4irXcwu7Ebh3nTIGRepvxX2P5mEsrOVRcgw3sIVxsLt6ZZQY695hbHXWgnqX72CWF6t2Gax2"
};

var results = _client.CompleteMultipartUpload(cmp);

I get an error message "Amazon.S3.AmazonS3Exception : The XML you provided was not well-formed or did not validate against our published schema". There seem to be an error in the API. Anyone know how I can fix this?

asked a year ago903 views
2 Answers
1
Accepted Answer

Your request is missing the ETag and part number values of the uploaded parts. The multipart upload ID isn't enough to complete the upload. You have to provide the full part list as well.

There's example code at the end of this documentation page: https://docs.aws.amazon.com/sdkfornet/v3/apidocs/items/S3/TCompleteMultipartUploadRequest.html

EXPERT
answered a year ago
AWS
EXPERT
reviewed 3 months ago
  • Thank you. That was the issue. Since PartETags is required it would be helpful if AmazonS3Client throw an exception with an informative message instead an unhelpful error from HTTP request.

0

Generally, this "MalformedXML" error from “POST Upload" request indicate the POST object provided in the request body is incorrect and S3 cannot parse it for validation of each failure uploaded object. While S3 doesn't record the raw or parsed request information in our server side logs. [+] https://docs.aws.amazon.com/AmazonS3/latest/userguide/mpu-upload-object.html

  1. Is the issue is intermittent?. If yes, Is there something unique about the files having issue, such as their content, encoding, size, or metadata, which may be causing the problem. Could you please give us more context around this?

  2. Can we get a self-contained code snippet just related to this issue which can be used to simply reproduce the issue? With the help of the code we can also check how you are defining the parts.

  3. If the issue can be reproduced in Test environment, kindly enable verbose logging for the application and share the logs with us. Instructions to enable verbose wire logging in java v1 can be found in below document. [+] https://docs.aws.amazon.com/sdk-for-java/v1/developer-guide/java-dg-logging.html#sdk-net-logging-verbose

  4. If possible, please also share the full stack trace error that is being thrown. Could you please also tell us the file size which you are trying to upload?

AWS
SUPPORT ENGINEER
answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions