0

I'm getting a content-length 411 error. The variables in completeMultipartUpload are all valid, as well as their structure. The issue is the content-length header: Here's the error:

S3 Error: Error executing "CompleteMultipartUpload" on "https://v5l2.da.idrivee2-25.com/etc..."; AWS HTTP error: Client error: POST https://v5l2.da.idrivee2-25.com/lightvault-dev/0oTKAVReHXVwUuG?uploadId=582eab69-c4f6-47e0-9022-7df4b2702108 resulted in a 411 Length Required response:

MissingContentLengthYou must provide the Content-Len (truncated...)MissingContentLength (client): You must provide the Content-Length HTTP header. - MissingContentLengthYou must provide the Content-Length HTTP header.0oTKAVReHXVwUuGlightvault-dev/lightvault-dev/0oTKAVReHXVwUuG1780D527E55D2DBAdc178504-d6ed-4ffa-859f-95f1758bdcd1 Request ID: 1780D527E55D2DBA Error Type: client Error Code: MissingContentLength

        // Complete the multipart upload
        $result = $s3->completeMultipartUpload([
            'Bucket' => $bucket,
            'Key' => $key,
            'UploadId' => $uploadId,
            'Parts' => $parts
        ]);

        if ($result->get('@metadata')['HTTPStatusCode'] == 200) {
            echo "success";
        } else {
            echo $result->get('Error')['Message'];
        }
Mike
  • 155
  • 1
  • 11

1 Answers1

0

According to the Amazon Documentation, you need to specify Content-Type header and based on your error message, it looks like you need to specify the Content-Length header as well. I haven't worked with AWS and you do not have the code that shows where you specified any headers, so I can't see if you did specify and if there were any issues in the way you specified it, but you need to specify those two headers, if you haven't already. If you did specify then there is probably a syntax error or something wrong with how or when you specified them. Can you review the headers you are sending to make sure Content-Type and Content-Length are there and correct?

  • Thanks for the reply. By default, AWS sdk does not require you to specify headers. I had a structural error in my code. – Mike Sep 02 '23 at 14:50