Hey guys, quick question, I'm getting an CORS erro...
# orm-help
r
Hey guys, quick question, I'm getting an CORS error when trying to upload a file to localhost:4000/upload from a create-react-app on localhost:3000. The weird thing is, the File actually gets created and I get back a correct response in the server logs, but I still get a CORS error. I am missing something stupid?
h
you need to add cors to route
r
I thought graphql yoga did that by default? I followed the exact example here: https://github.com/maticzav/graphql-server-file-upload-example
nowhere is there a mention of CORS
n
what is the exact response you get?
r
Copy code
Failed to load <http://localhost:4000/upload>: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin '<http://localhost:3000>' is therefore not allowed access.
and
Copy code
Error: Network Error
    at createError (createError.js:16)
    at XMLHttpRequest.handleError (xhr.js:87)
When I was working with react native, I got no errors, but now Im working on a web alternative.
The weird thing is that I do see the file being created in my logs and in the data browser