TL: DR: Upload to a Google Cloud bucket fine with Export File Type Binary, always get cors error with Export File type Image (PNG).
Why is CORS always so painful. I have successfully setup a GCS resource to a bucket. Using the following CORS value works find as long as the Export File Type is set to Binary:
[{ "maxAgeSeconds": 3600, "method": ["GET", "HEAD", "POST", "PUT", "DELETE"], "origin": ["https://*.retool.com"], "responseHeader": ["Content-Type", "x-goog-acl"] }]
Once I set the Export File Type in the resource from Binary
to Image (PNG)
I receive CORS errors. I Even set the following setting and waited 3600 seconds:
[ { "origin": ["*"], "responseHeader": ["*"], "method": ["*"] } ]
And yet there is a CORS error on our retool domain. Since it works fine with type Binary
I am wondering if it may possibly be a Retool issue, and not a configuration issue. Thoughts, considerations?
GCS Action set to 'Upload data'
Hello! Thanks for the message. Weβre going to look into this later today β we should get back to you by EOD tomorrow!
Hi @brettski this is very interesting. Let me try and reproduce this issue now and see where we get!
@will ever discover anything with this?
Hi @brett, Iβm a developer at Retool. Iβve been looking into this issue for a bit and discovered it may go pretty deep and involve a major over-haul.
How important is this to you?
For example, can you work around this by uploading your file and then change the content-type using a separate query?
I really appreciate you getting back to me on this. It is a pain as I have to follow up with a gcp cli call after uploads to set the correct value.
What about the auto
option provided by google cloud to set the Content-Type? So instead of it being explicitly set in your drop-down, add an auto value which allows Google Cloud to set it. I have a process outside of Retool which I used this value which has been pretty successful for different file types.
For example using node bucket upload, simply setting bucket.upload('/path/to/file.svg')
uploads the file to that bucket and sets the correct Content-Type.
I obviously have no idea how Retool has structured their Google Cloud connector or if adding such functionality runs as βdeepβ as the issue I discovered; though having an βautoβ option could handle 80% of the file cases and be a good working solution until the deeper issue can be resolved.
Kindest regards,
Brett
Has this issue been shelved? Looking to see if may actually be corrected.
@hiren
Hi @brettski, we put out a fix for this recently. We should have notified you.
Is it still not working for you? Let us know.
Hi @hiren, what was the fix? The result or options for uploading a file havenβt changed. They are still only uploaded as Binary, JSON, or csv content types. They application I wrote uploads images to GCP, so for EACH image uploaded a follow up command is run locally to changed the content type of the files so it may be downloaded correctly when requested from the bucket.
Kind regards,
Brett
Ah, I reread things. So this was for the CORS errors received from the upload. Yeah, thatβs corrected. I guess I am SOL on the content type or GCSconnector.uploadFileType
being set to anything other than binary, json, or csv