是什么导致代理停止在React应用程序中工作?
我的React/FastApi应用程序具有代理
代理”:“ http:// localhost:8000
在我的软件包中
。 (500)在位置0 的JSON中意外的令牌P
我尝试了
http://127.0.0.1:8000
用于代理和同样的问题。
我检查了Fastapi后端,一切正常。如果我将整个路径放在获取中,那就没问题了。
我知道该错误是否说意外的令牌<
,那么这意味着我会恢复一些HTML而不是JSON,但我不知道p
在此错误中意味着什么。
我升级了节点。这可能是错误的原因吗?什么是什么突破代理?
谢谢
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看来Node
v17.xx
正在引起我的代理问题。我降级到v16.14.2
(大约是我在更新/升级之前的版本),并且问题消失了。我将看看情况如何,但是关于节点
v17
的某些内容正在引起代理问题。It appears that Node
v17.x.x
was causing problems with my proxy. I downgraded tov16.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.