createPresignedPost upload attempt in results in 400 (Bad Request)

0

When attempting to use a presigned post url to upload an image to s3, a 400 (Bad Request) response is returned from S3

I'm using the Vercel S3 upload example as the pattern

The Lambda function (node js) returning the presigned url is using a user with Administrative Access

S3 has the following CORS policy

[
    {
        "AllowedHeaders": [
            "*"
        ],
        "AllowedMethods": [
            "GET",
            "PUT",
            "POST"
        ],
        "AllowedOrigins": [
            "*"
        ],
        "ExposeHeaders": []
    }
]

How can I resolve this issue an successfully upload to s3?

已提问 2 年前297 查看次数
3 回答
1

In my experience, this happens when the request doesn't exactly match the presigned URL that was created.

Make sure that you include the content type when signing the URL; and that the content type is the same when you send the request.

profile pictureAWS
专家
已回答 2 年前
0
已接受的回答

I was using a customer managed key improperly instead of the s3 managed key. That was the more specific issue

已回答 2 年前
0

After using Postman, I found out the issue is KMS. Server side encryption was enabled on the bucket and that was causing the error

已回答 2 年前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则