'What causes proxy to stop working in a React app?
My React/FastAPI application had proxy
proxy": "http://localhost:8000
in my package.json working fine but now the proxy doesn't work and I get back
Internal Server Error (500) Unexpected token P in JSON at position 0
I tried
http://127.0.0.1:8000
for proxy and the same problem.
I checked the FastAPI backend and everything works fine. If I put the whole path inside fetch, then there is no problem.
I know if the error said Unexpected token < then that means I got back some HTML instead of JSON but I don't know what the P means in this error.
I upgraded Node. Could that be the cause of the error? What exactly breaks proxy?
Thank you
Solution 1:[1]
It appears that Node v17.x.x was causing problems with my proxy. I downgraded to v16.14.2 (which was approximately the version that I had before the update/upgrade) and the problems are gone.
I am going to see how it goes but something about node v17 is causing problems with proxy.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Reggie |
