<@U6Z07HY14> Alright I’ll give that a shot
# prisma-whats-new
j
@lawjolla Alright I’ll give that a shot
l
Are you familar with CORS errors?
j
Oh Not super familiar but I’ve run into them before
Do you know how to set it with Axios?
Or fetch
l
It's a browser protection that blocks calls to servers that don't allow calls from that domain. So if your browser is on google.com, and google.com sends a fetch call to bing.com, bing.com has to allow it. And Bing allows it by setting the "cross origin resource sharing" policy in the headers, e.g. allow POST/GET/etc from Google
It's not set on the client, it's set on the server
j
Trying to communicate with the FileAPI of Graphcool
I don’t have any control of their end
l
Did you google CORS and graphcool?
j
A fair amount so far
l
I just looked at your sandbox. Your problem isn't CORS. It's throwing a 500 error, and that error doesn't have a CORS header, so you're seeing CORS with it
j
hmm
Any idea what might be causing the 500 error?
n
@lawjolla is right with his latest statement 🙂
generally, something is wrong with your request (either with headers or the structure of the FormData)
j
Is there a sample of a working upload for react any where. I’ve tried several and attempted to be as basic as possible
n
here's a code snippet using
axios
that should work: https://github.com/graphcool/content/issues/95
j
Got it to work The axios code snippet did the trick. Thanks for the help guys
👌 1
@nilan I cleaned up and organized the code in that sandbox to have both axios and fetch code (axios is commented out). They are both working. Here’s the link if you’d like to share it in the future. https://codesandbox.io/s/zq056ro42m I also posted a quick medium article with the info to possibly help someone in the future. https://medium.com/@JasonSooter/simple-graph-cool-file-uploader-for-react-a2b6856c2306
👌 1
parrotwave6 1