AWS S3 - How to fix 'The request signature we calculated does not match the signature' error?

后端 未结 30 2583
谎友^
谎友^ 2020-11-29 08:05

I have searched on the web for over two days now, and probably have looked through most of the online documented scenarios and workarounds, but nothing worked for me so far.

相关标签:
30条回答
  • 2020-11-29 08:16

    I just experienced this uploading an image to S3 using the AWS SDK with React Native. It turned out to be caused by the ContentEncoding parameter.

    Removing that parameter "fixed" the issue.

    0 讨论(0)
  • 2020-11-29 08:16

    generating a fresh access key worked for me.

    0 讨论(0)
  • 2020-11-29 08:17

    I had the same error in nodejs. But adding signatureVersion in s3 constructor helped me:

    const s3 = new AWS.S3({
      apiVersion: '2006-03-01',
      signatureVersion: 'v4',
    });
    
    0 讨论(0)
  • 2020-11-29 08:19

    For Python set - signature_version s3v4

    s3 = boto3.client(
       's3',
       aws_access_key_id='AKIAIO5FODNN7EXAMPLE',
       aws_secret_access_key='ABCDEF+c2L7yXeGvUyrPgYsDnWRRC1AYEXAMPLE',
       config=Config(signature_version='s3v4')
    )
    
    0 讨论(0)
  • 2020-11-29 08:20

    I resolved this issue by changing the public permissions on my AWS s3 bucket and by adding the CORS configuration bellow to my bucket settings.

    <?xml version="1.0" encoding="UTF-8"?>
    <CORSConfiguration>
    <CORSRule>
        <AllowedOrigin>*</AllowedOrigin>
        <AllowedMethod>HEAD</AllowedMethod>
        <AllowedMethod>GET</AllowedMethod>
        <AllowedMethod>PUT</AllowedMethod>
        <AllowedMethod>POST</AllowedMethod>
        <AllowedHeader>*</AllowedHeader>
    </CORSRule>
    </CORSConfiguration>
    

    See AWS s3 documentation for more infos.

    0 讨论(0)
  • 2020-11-29 08:21

    I had the same issue. I had the default method, PUT set to define the pre-signed URL but was trying to perform a GET. The error was due to method mismatch.

    0 讨论(0)
提交回复
热议问题