-
Notifications
You must be signed in to change notification settings - Fork 47
Description
Hi there! I'm sorry to bother you with a support issue like this. I'm probably just doing something silly, but when I use gcs-browser-upload
I get a cors preflight error.
Using gcs-browser-upload
So when I try and do the following (signedUrl
is a url I got from our API):
const upload = new Upload({
id: signedUrl,
url: signedUrl,
file,
onChunkUpload: (info) => {
logger.debug('Chunk uploaded', info);
},
});
await upload.start();
I get this error: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:1234' is therefore not allowed access.
Using axios
:
When I use axios using the same signedUrl like this:
await axios({
method: 'put',
url: signedUrl,
data: file,
headers: {
'Content-Type': file.type,
},
});
I don't get a CORS error.
Question:
I read on this post http://opreview.blogspot.com/2017/03/how-to-upload-to-google-cloud-storage.html, that you need to make an additional request to gcs to get a resumable url, using your signed url. Do I need to do this, even when I am using your library?