Skip to content

S3 Put Object SignatureDoesNotMatch error in 0.0.17-alpha #220

@chinedufn

Description

@chinedufn

Bug Report

Can't use S3 put object in 0.0.17-alpha. Works fine in 0.0.15-alpha.

Notably, I'm now using the aws_config and aws-sdk-s3 v0.0.17-alpha crates now.

Using s3 0.0.15-alpha with let s3_client = S3Client::from_env(); works just fine.

Version

aws-config = { git = "https://github.com/awslabs/aws-sdk-rust", tag = "v0.0.17-alpha" }
aws-sdk-s3 = { git = "https://github.com/awslabs/aws-sdk-rust", tag = "v0.0.17-alpha" }

Platform

Darwin MacBook-Pro.XXX.YYY 19.6.0 Darwin Kernel Version 19.6.0: Mon Aug 31 22:12:52 PDT 2020; ZZZ/RELEASE_X86_64 x86_64

Description

I'm seeing Error { code: "SignatureDoesNotMatch", message: "The request signature we calculated does not match the signature you provided. Check your key and signing method.", ... } for:

let shared_config = aws_config::load_from_env().await;
let s3_client = S3Client::new(&shared_config);

let put_object_request = s3_client
    .put_object()
    .body(ByteStream::from(vec![1,2]))
    .bucket(BUILDS_BUCKET)
    .content_length(2)
    .key("delete-me".to_string());

put_object_request.send().await?;

This worked fine for me in 0.0.15-alpha, but is now broken in 0.0.17-alpha.

Trace Logs

Trace Logs
Sep 08 12:53:10.253 TRACE smithy_http_tower::dispatch: request=Request { method: PUT, uri: https://s3.{REGION}.amazonaws.com/{BUCKET}/delete-me?x-id=PutObject, version: HTTP/1.1, headers: {"content-length": "2", "content-length": "2", "content-type": "application/octet-stream", "user-agent": "aws-sdk-rust/0.1.0 os/macos lang/rust/1.56.0-nightly", "x-amz-user-agent": "aws-sdk-rust/0.1.0 api/s3/0.0.17-alpha os/macos lang/rust/1.56.0-nightly", "authorization": Sensitive, "x-amz-date": "20210908T165310Z", "x-amz-content-sha256": "a12871fee210fb8619291eaea194581cbd2531e4b23759d225f6806923f63222"}, body: SdkBody { inner: Once(Some(b"\x01\x02")), retryable: true } }
Sep 08 12:53:10.370 TRACE smithy_http::middleware: http_response=Response { status: 403, version: HTTP/1.1, headers: {"x-amz-request-id": "HC9SNWSXSXE6K63V", "x-amz-id-2": "EeJL9mx55tnWtPDE4bwMsRGiv7Oxfmx8e52XdXO+jwaV8CqW54cE1FYS8FcdGr4asgF1NJK58OU=", "content-type": "application/xml", "transfer-encoding": "chunked", "date": "Wed, 08 Sep 2021 16:53:09 GMT", "server": "AmazonS3", "connection": "close"}, body: b"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Error><Code>SignatureDoesNotMatch</Code><Message>The request signature we calculated does not match the signature you provided. Check your key and signing method.</Message><AWSAccessKeyId>{ACCESS_KEY_ID}</AWSAccessKeyId><StringToSign>AWS4-HMAC-SHA256\n20210908T165310Z\n20210908/us-east-1/s3/aws4_request\ne20c2fae54cba822d6ab1b754777b01634851ab4a78998c555d7aab40e604146</StringToSign><SignatureProvided>0c9e1e3527321fd71b9b305745022b180ac7fa0d576352ed34402d4ec7fda3a6</SignatureProvided><StringToSignBytes>41 57 53 34 2d 48 4d 41 43 2d 53 48 41 32 35 36 0a 32 30 32 31 30 39 30 38 54 31 36 35 33 31 30 5a 0a 32 30 32 31 30 39 30 38 2f 75 73 2d 65 61 73 74 2d 31 2f 73 33 2f 61 77 73 34 5f 72 65 71 75 65 73 74 0a 65 32 30 63 32 66 61 65 35 34 63 62 61 38 32 32 64 36 61 62 31 62 37 35 34 37 37 37 62 30 31 36 33 34 38 35 31 61 62 34 61 37 38 39 39 38 63 35 35 35 64 37 61 61 62 34 30 65 36 30 34 31 34 36</StringToSignBytes><CanonicalRequest>PUT\n/afia-private-builds/delete-me\nx-id=PutObject\ncontent-length:2\ncontent-type:application/octet-stream\nhost:s3.us-east-1.amazonaws.com\nx-amz-content-sha256:a12871fee210fb8619291eaea194581cbd2531e4b23759d225f6806923f63222\nx-amz-date:20210908T165310Z\nx-amz-user-agent:aws-sdk-rust/0.1.0 api/s3/0.0.17-alpha os/macos lang/rust/1.56.0-nightly\n\ncontent-length;content-type;host;x-amz-content-sha256;x-amz-date;x-amz-user-agent\na12871fee210fb8619291eaea194581cbd2531e4b23759d225f6806923f63222</CanonicalRequest><CanonicalRequestBytes>50 55 54 0a 2f 61 66 69 61 2d 70 72 69 76 61 74 65 2d 62 75 69 6c 64 73 2f 64 65 6c 65 74 65 2d 6d 65 0a 78 2d 69 64 3d 50 75 74 4f 62 6a 65 63 74 0a 63 6f 6e 74 65 6e 74 2d 6c 65 6e 67 74 68 3a 32 0a 63 6f 6e 74 65 6e 74 2d 74 79 70 65 3a 61 70 70 6c 69 63 61 74 69 6f 6e 2f 6f 63 74 65 74 2d 73 74 72 65 61 6d 0a 68 6f 73 74 3a 73 33 2e 75 73 2d 65 61 73 74 2d 31 2e 61 6d 61 7a 6f 6e 61 77 73 2e 63 6f 6d 0a 78 2d 61 6d 7a 2d 63 6f 6e 74 65 6e 74 2d 73 68 61 32 35 36 3a 61 31 32 38 37 31 66 65 65 32 31 30 66 62 38 36 31 39 32 39 31 65 61 65 61 31 39 34 35 38 31 63 62 64 32 35 33 31 65 34 62 32 33 37 35 39 64 32 32 35 66 36 38 30 36 39 32 33 66 36 33 32 32 32 0a 78 2d 61 6d 7a 2d 64 61 74 65 3a 32 30 32 31 30 39 30 38 54 31 36 35 33 31 30 5a 0a 78 2d 61 6d 7a 2d 75 73 65 72 2d 61 67 65 6e 74 3a 61 77 73 2d 73 64 6b 2d 72 75 73 74 2f 30 2e 31 2e 30 20 61 70 69 2f 73 33 2f 30 2e 30 2e 31 37 2d 61 6c 70 68 61 20 6f 73 2f 6d 61 63 6f 73 20 6c 61 6e 67 2f 72 75 73 74 2f 31 2e 35 36 2e 30 2d 6e 69 67 68 74 6c 79 0a 0a 63 6f 6e 74 65 6e 74 2d 6c 65 6e 67 74 68 3b 63 6f 6e 74 65 6e 74 2d 74 79 70 65 3b 68 6f 73 74 3b 78 2d 61 6d 7a 2d 63 6f 6e 74 65 6e 74 2d 73 68 61 32 35 36 3b 78 2d 61 6d 7a 2d 64 61 74 65 3b 78 2d 61 6d 7a 2d 75 73 65 72 2d 61 67 65 6e 74 0a 61 31 32 38 37 31 66 65 65 32 31 30 66 62 38 36 31 39 32 39 31 65 61 65 61 31 39 34 35 38 31 63 62 64 32 35 33 31 65 34 62 32 33 37 35 39 64 32 32 35 66 36 38 30 36 39 32 33 66 36 33 32 32 32</CanonicalRequestBytes><RequestId>HC9SNWSXSXE6K63V</RequestId><HostId>EeJL9mx55tnWtPDE4bwMsRGiv7Oxfmx8e52XdXO+jwaV8CqW54cE1FYS8FcdGr4asgF1NJK58OU=</HostId></Error>" }
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error { code: "SignatureDoesNotMatch", message: "The request signature we calculated does not match the signature you provided. Check your key and signing method.", request_id: "HC9SNWSXSXE6K63V", s3_extended_request_id: "EeJL9mx55tnWtPDE4bwMsRGiv7Oxfmx8e52XdXO+jwaV8CqW54cE1FYS8FcdGr4asgF1NJK58OU=" }

Caused by:
    0: Error { code: "SignatureDoesNotMatch", message: "The request signature we calculated does not match the signature you provided. Check your key and signing method.", request_id: "HC9SNWSXSXE6K63V", s3_extended_request_id: "EeJL9mx55tnWtPDE4bwMsRGiv7Oxfmx8e52XdXO+jwaV8CqW54cE1FYS8FcdGr4asgF1NJK58OU=" }
    1: Error { code: "SignatureDoesNotMatch", message: "The request signature we calculated does not match the signature you provided. Check your key and signing method.", request_id: "HC9SNWSXSXE6K63V", s3_extended_request_id: "EeJL9mx55tnWtPDE4bwMsRGiv7Oxfmx8e52XdXO+jwaV8CqW54cE1FYS8FcdGr4asgF1NJK58OU=" }', crates/internal-cli/src/main.rs:6:16
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Metadata

Metadata

Assignees

Labels

bugThis issue is a bug.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions