Intermittent CORS issue when uploading files to Google Cloud Storage

I am using Retool’s built-in integration to upload files to Google Cloud Storage. I have followed the advice on setting the CORS setting (we host internally so we have set the domain to our retool domain).

However, intermittently, we receive the error “Query Error (upload_docs_gcs): Failed to upload. This might be due to a CORS issue on the bucket, so please double check that your CORS settings are correct.”

After I receive that error I reset the CORS settings using gsutil and it appears to resolve it though.

I have attached a screenshot of the configuration.

I have a similar problem, but for me I keep getting this error:
“query2: Failed to upload. This might be due to a CORS issue on the bucket, so please double check that your CORS settings are correct.”

If I may get your help, what was your CORS json?

It turns out our issue was an automated terraform script that was running and resetting the cors configuration we had manually applied. It’s working again now. We used a file that looks like:

[
    {
      "origin": ["https://retool.ourcompany.com"],
      "responseHeader": ["Content-Type", "x-goog-acl"],
      "method": ["GET", "HEAD","POST", "PUT", "DELETE"],
      "maxAgeSeconds": 3600
    }
]

We applied it using

gsutil cors set path/to/cors-file.json gs://our-bucket