Problem description
This error occurs during a multipart upload that uses an S3 SDK. The error indicates that the Content-Encoding is set to aws-chunked and is incompatible with the x-amz-content-sha256 value.
Cause
This error is triggered during a multipart upload that uses an S3 SDK if the request header meets the following conditions:
Content-Encoding is set to aws-chunked.
The value of x-amz-content-sha256 is incompatible with aws-chunked encoding.
When OSS processes a request that uses aws-chunked encoding, the x-amz-content-sha256 parameter must be set to a specific value, such as STREAMING-AWS4-HMAC-SHA256-PAYLOAD. If an unsupported value is used for x-amz-content-sha256, the request is denied.
Example
In the following request, the Content-Encoding header is set to aws-chunked, but the x-amz-content-sha256 header has an incompatible value:
PUT /example-object HTTP/1.1
Host: example-bucket.oss-cn-hangzhou.aliyuncs.com
Content-Encoding: aws-chunked
x-amz-content-sha256: UNSIGNED-PAYLOAD
x-amz-date: 20240320T103000Z
Transfer-Encoding: chunked
Authorization: AWS4-HMAC-SHA256 Credential=...
[Chunked Body]The returned error message is as follows:
HTTP/1.1 400 Bad Request
Server: AliyunOSS
Date: Mon, 20 Mar 2024 10:30:00 GMT
Content-Type: application/xml
Content-Length: 534
x-oss-request-id: 68******************20
x-oss-ec: 0017-00000804
<?xml version="1.0" encoding="UTF-8"?>
<Error>
<Code>InvalidArgument</Code>
<Message>aws-chunked encoding is not supported with the specified x-amz-content-sha256 value.</Message>
<RequestId>68******************20</RequestId>
<HostId>example-bucket.oss-cn-hangzhou.aliyuncs.com</HostId>
<ArgumentName>Content-Encoding</ArgumentName>
<ArgumentValue>aws-chunked</ArgumentValue>
<EC>0017-00000804</EC>
<RecommendDoc>https://api.aliyun.com/troubleshoot?q=0017-00000804</RecommendDoc>
</Error>Solutions
If you use aws-chunked encoding, set x-amz-content-sha256 to STREAMING-AWS4-HMAC-SHA256-PAYLOAD.
If you do not need aws-chunked encoding, remove the Content-Encoding request header or set it to a different value.
Use the standard OSS multipart upload method instead of the aws-chunked encoding attribute from the S3 SDK.
Make sure the S3 SDK version you use supports the OSS implementation of aws-chunked encoding. Update to the latest version if needed.
References
For more information about OSS multipart upload, see Multipart upload.
For more information about S3 compatibility, see OSS compatibility with Amazon S3.
For more information about how to use an AWS SDK to access OSS, see Use an AWS SDK to access OSS.