-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Getting a CORS error #13
Comments
@hendrikswan can you tell me how to use this lib to upload files to gcs? Read funtional test but i haven't understood yet |
I followed this working example that just uses Before running that test, I had to create a Then I created a [{
"maxAgeSeconds": 86400,
"method": ["*"],
"origin": ["*"],
"responseHeader": ["*"]
}] and then I ran the following command in a terminal: gsutil cors set bucket-cors-config.json gs://my-bucket-name After that, I ran I will be testing with Axios next. Then I will try out this project (QubitProducts/gcs-browser-upload). |
That github project that I linked to shows you the server side of things too, where you generate the signed URL. Now that I have a simple working example without using any external libraries at all, it will be easier to debug whats going on when using |
One last note - many things can mess up |
@hendrikswan @waynebloss sorry for the delayed response - notifications were somehow turned off for this repo, so I had no idea you guys were posting! When you create a resumable upload URL using the Google Cloud API, you have to provide an origin URL. This is the URL of the website that you will be doing the upload from (in your case, |
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):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:
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?
The text was updated successfully, but these errors were encountered: