Cors error when trying to upload image

Hello, I added an upload image function to my site so users can upload images but I get this error when someone tries to post an image after uploading it

This is my core.json configuration

[
  {
    "origin": ["*"],
    "method": ["GET", "POST", "PUT", "DELETE", "OPTIONS"],
    "responseHeader": [
      "Content-Type",
      "Content-Length",
      "Authorization",
      "X-Requested-With",
      "X-Goog-Upload-Protocol",
      "X-Goog-Upload-Command",
      "X-Goog-Upload-Offset",
      "X-Goog-Upload-Status",
      "X-Goog-Upload-Header-Content-Length",
      "X-Goog-Upload-Header-Content-Type",
      "X-GUploader-UploadID",
      "X-Firebase-Storage-Version",
      "X-Firebase-GMPID"
    ],
    "maxAgeSeconds": 3600
  }
]

You need to create the structure for it, it isn’t enough to enable storage upload. put this error thru AI any AI and it will explain to you the stepts you need to get google cloud sdk shell follow the steps and in the end also fix your functions to handle the new configuration. Then it will work, just done this 2 days ago

I had an issue that the storage was not correctly pointed to by the generative AI it look almost similar but it wasnt

[gs://yourplatforn-platform.firebasestorage.app] this example was something like this [gs://yourplatforn-platform.firebase.app small typo but it was not pointing correctly

I have done gsutil cors set cors.json gs://pedaleziro-ngcst.firebasestorage.app and the gsutil cors get gs://pedaleziro-ngcst.firebasestorage.app indicates that everything is set right but I don’t understand why it doesn’t work

Found the error, I accidentaly introduced in config.ts that my bucket is gs://pedaleziro-ngcst.appspot.com instead of gs://pedaleziro-ngcst.firebasestorage.app

Exactly, the AI does this mistake, it did it the same for me

1 Like