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?

gefragt vor 2 Jahren297 Aufrufe
3 Antworten
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
EXPERTE
beantwortet vor 2 Jahren
0
Akzeptierte Antwort

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

beantwortet vor 2 Jahren
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

beantwortet vor 2 Jahren

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen