Problem description
This error occurs during a multipart upload that uses an S3 SDK. It indicates that Content-Encoding is set to aws-chunked but x-amz-content-sha256 is set to an incompatible value.
Causes
OSS returns this error when a request meets both of the following conditions:
Content-Encodingis set toaws-chunked.x-amz-content-sha256is set to an incompatible value.
When aws-chunked encoding is used, OSS requires the following header pairing:
| Header | Required value |
|---|---|
Content-Encoding | aws-chunked |
x-amz-content-sha256 | STREAMING-AWS4-HMAC-SHA256-PAYLOAD |
Any other value for x-amz-content-sha256—such as UNSIGNED-PAYLOAD—causes the request to fail with a 400 error.
Examples
The following request triggers this error. Content-Encoding is set to aws-chunked, but x-amz-content-sha256 is set to the incompatible value UNSIGNED-PAYLOAD:
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]OSS returns the following error response:
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>The following is a corrected request with x-amz-content-sha256 set to the required value:
PUT /example-object HTTP/1.1
Host: example-bucket.oss-cn-hangzhou.aliyuncs.com
Content-Encoding: aws-chunked
x-amz-content-sha256: STREAMING-AWS4-HMAC-SHA256-PAYLOAD
x-amz-date: 20240320T103000Z
Transfer-Encoding: chunked
Authorization: AWS4-HMAC-SHA256 Credential=...
[Chunked Body]Solutions
If you use `aws-chunked` encoding: Set
x-amz-content-sha256toSTREAMING-AWS4-HMAC-SHA256-PAYLOAD.If you do not need `aws-chunked` encoding: Remove the
Content-Encodingheader or set it to a different value.If you want to avoid S3 SDK encoding constraints: Use the standard OSS multipart upload method instead of the
aws-chunkedencoding from the S3 SDK.If the issue persists: Make sure the S3 SDK version you use supports the OSS implementation of
aws-chunkedencoding. Update to the latest version if needed.