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?

asked 2 years ago290 views
3 Answers
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
EXPERT
answered 2 years ago
0
Accepted Answer

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

answered 2 years ago
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

answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions