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?

posta 2 anni fa297 visualizzazioni
3 Risposte
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
ESPERTO
con risposta 2 anni fa
0
Risposta accettata

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

con risposta 2 anni fa
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

con risposta 2 anni fa

Accesso non effettuato. Accedi per postare una risposta.

Una buona risposta soddisfa chiaramente la domanda, fornisce un feedback costruttivo e incoraggia la crescita professionale del richiedente.

Linee guida per rispondere alle domande