Skip to content

S3: Multipart upload fails with invalid request signature #1543

@HenryS1

Description

@HenryS1

Hello

After updating pekko connectors to 1.3.0 and the aws sdk to 2.42.2 I get the following error when I try to run a multipart upload.

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.

Previously I was on pekko connectors 1.2.0 and aws sdk 2.29.52.

I noticed this happening in application code but it also happens if I use the following snippet extracted from S3ITTest.scala in this repository, where I supply my own bucket name and client.

      val fileContent = (0 to 1000000).mkString
      val createMultipartUploadResponse = client
        .createMultipartUpload(
          CreateMultipartUploadRequest.builder().bucket(bucketName).key("bar").contentType("text/plain").build())
        .join()

      val p1 = client
        .uploadPart(
          UploadPartRequest
            .builder()
            .bucket(bucketName)
            .key("bar")
            .partNumber(1)
            .uploadId(createMultipartUploadResponse.uploadId())
            .build(),
          AsyncRequestBody.fromString(fileContent))
        .join
      val p2 = client
        .uploadPart(
          UploadPartRequest
            .builder()
            .bucket(bucketName)
            .key("bar")
            .partNumber(2)
            .uploadId(createMultipartUploadResponse.uploadId())
            .build(),
          AsyncRequestBody.fromString(fileContent))
        .join

      client
        .completeMultipartUpload(
          CompleteMultipartUploadRequest
            .builder()
            .bucket(bucketName)
            .key("bar")
            .uploadId(createMultipartUploadResponse.uploadId())
            .multipartUpload(
              CompletedMultipartUpload
                .builder()
                .parts(CompletedPart.builder().partNumber(1).eTag(p1.eTag()).build(),
                  CompletedPart.builder().partNumber(2).eTag(p2.eTag()).build())
                .build())
            .build())
        .join

      val result = client
        .getObject(GetObjectRequest.builder().bucket(bucketName).key("bar").build(),
          AsyncResponseTransformer.toBytes[GetObjectResponse]())
        .join

The client is constructed like this

    S3AsyncClient.builder
      .credentialsProvider(DefaultCredentialsProvider.builder().build())
      .region(region)
      .httpClient(PekkoHttpClient.builder().withActorSystem(system).build())
      .build()

If I use the netty client instead of the pekko client the request works, but I want to use the pekko client.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions