Skip to content

Multipart upload signature error after updating the SDK #6778

Description

@HenryS1

Describe the bug

Multipart upload stopped working for me after I updated the SDK from version 2.29.52 to 2.42.8.

I'm not completely sure that this is a bug, but it appears to me that the requests I'm making should be valid in the new SDK. If there is something wrong with my requests please tell me how I should remedy the problem.

Here is a minimal example in scala that works in 2.29.52 and doesn't work in 2.42.8.

            val bucket = "my-bucket"
            val key = "my-key"

            val createRequest = awsModel.CreateMultipartUploadRequest.builder()
              .bucket(bucket)
              .key(key)
              .build()

            val createResult = Await.result(s3Client.createMultipartUpload(createRequest).asScala, 10 seconds)
            
            val partRequest = awsModel.UploadPartRequest.builder()
              .bucket(bucket)
              .key(key)
              .uploadId(createResult.uploadId())
              .partNumber(1)
              .contentLength(5)
              .build()

            val completedPart = Await.result(s3Client.uploadPart(
              partRequest,
              AsyncRequestBody.fromByteBuffer(ByteString("Hello").asByteBuffer)
            ).asScala, 10 seconds)

            val completeRequest = awsModel.CompleteMultipartUploadRequest.builder()
              .bucket(bucket)
              .key(key)
              .uploadId(createResult.uploadId())
              .multipartUpload(
                awsModel.CompletedMultipartUpload.builder()
                  .parts(
                    awsModel.CompletedPart.builder()
                      .partNumber(1)
                      .eTag(completedPart.eTag)
                      .build()
                  )
                  .build()
              )
              .build()

            Await.result(s3Client.completeMultipartUpload(completeRequest).asScala, 10 seconds)

On the old SDK version the requests are all successful and I can see the object in S3. When I use the new SDK version I get the following error:

java.util.concurrent.CompletionException: software.amazon.awssdk.services.s3.model.S3Exception: The request signature we calculated does not match the signature you provided. Check your key and signing method. (Service: S3, Status Code: 403, Request ID: 4BXHV234N122G6PP, Extended Request ID: j9jAU0fHyvZ+/KOVWSWAyxg0KDHIsw8rvQuLS7MJ/GEjSXu6iYQTNsWSl4p9x3ipnebpnr6zS6ei2hv2Fj+tccOgoD6yY0E4xaAJ6Zxz/Gg=) (SDK Attempt Count: 1)

After some debugging I found that the createMultipartUpload request succeeds and the uploadPart request fails.

Regression Issue

  • Select this option if this issue appears to be a regression.

Expected Behavior

The requests work and successfully create a new object in S3.

Current Behavior

I get this error:

java.util.concurrent.CompletionException: software.amazon.awssdk.services.s3.model.S3Exception: The request signature we calculated does not match the signature you provided. Check your key and signing method. (Service: S3, Status Code: 403, Request ID: 4BXHV234N122G6PP, Extended Request ID: j9jAU0fHyvZ+/KOVWSWAyxg0KDHIsw8rvQuLS7MJ/GEjSXu6iYQTNsWSl4p9x3ipnebpnr6zS6ei2hv2Fj+tccOgoD6yY0E4xaAJ6Zxz/Gg=) (SDK Attempt Count: 1)

Reproduction Steps

Here is a minimal example in scala that works in 2.29.52 and doesn't work in 2.42.8.

            val bucket = "my-bucket"
            val key = "my-key"

            val createRequest = awsModel.CreateMultipartUploadRequest.builder()
              .bucket(bucket)
              .key(key)
              .build()

            val createResult = Await.result(s3Client.createMultipartUpload(createRequest).asScala, 10 seconds)
            
            val partRequest = awsModel.UploadPartRequest.builder()
              .bucket(bucket)
              .key(key)
              .uploadId(createResult.uploadId())
              .partNumber(1)
              .contentLength(5)
              .build()

            val completedPart = Await.result(s3Client.uploadPart(
              partRequest,
              AsyncRequestBody.fromByteBuffer(ByteString("Hello").asByteBuffer)
            ).asScala, 10 seconds)

            val completeRequest = awsModel.CompleteMultipartUploadRequest.builder()
              .bucket(bucket)
              .key(key)
              .uploadId(createResult.uploadId())
              .multipartUpload(
                awsModel.CompletedMultipartUpload.builder()
                  .parts(
                    awsModel.CompletedPart.builder()
                      .partNumber(1)
                      .eTag(completedPart.eTag)
                      .build()
                  )
                  .build()
              )
              .build()

            Await.result(s3Client.completeMultipartUpload(completeRequest).asScala, 10 seconds)

Possible Solution

No response

Additional Information/Context

No response

AWS Java SDK version used

2.42.8

JDK version used

openjdk 21.0.5 2024-10-15 LTS

Operating System and version

Ubuntu 20.04.6 LTS

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugThis issue is a bug.third-partyThis issue is related to third-party libraries or applications.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions