nextjs-gcp-storage
nextjs-gcp-storage copied to clipboard
Cross-Origin Request Blocked:
Hello,
Using the code provided and the instructions, I tried to upload a file to my bucket, but in the dev console got the error:
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://storage.googleapis.com/my-bucket-name-here/. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing). Status code: 400.
Could you please advise on how to solve this? Thanks in advance!
@damiano216 Please provide information that logged out of this command:
gcloud storage buckets describe gs://BUCKET_NAME --format="default(cors)"
The CORS is misconfigured if the above command returns a null or nothing. The expected result from this command is something like this:
cors:
- maxAgeSeconds: 3600
method:
- POST
- DELETE
origin:
- '*'
responseHeader:
- '*'