Next.js Discord

Discord Forum

aws-s3-image-upload-nextjs

Unanswered
American Bobtail posted this in #help-forum
Open in Discord
American BobtailOP
Hi all, I'm looking at the aws-s3-image-upload-nextjs example and am getting a CORS forbidden error. This occurs on the client after having received the signed URL. As far as I can tell, I have set the bucket up exactly as in the instructions. Just wondering if anyone else has had cors errors with this example and managed to fix them?

2 Replies

American BobtailOP
aha, fixed it myself - I created the user's policy again and it worked. Here's the policy in case anyone else has the problem. (Note it was the last line that fixed it)
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"s3:PutObject",
"s3:GetObject",
"s3:ListBucket",
"s3:DeleteObject",
"s3:PutObjectAcl"
],
"Resource": [
"arn:aws:s3:::mybucket",
"arn:aws:s3:::mybucket/*"
]
}
]
}