good day everyone.
I have develop a front and back web app that consist of some chemical engineering calculations. In the designer>pipes>liquid page i send a post with two numbers to the backend, where after some calculations it returns the answer that gets rendered in the frontend.
I test on my localhost and everything went fine, nevertheless, when i uploaded all the repo to render and i use the form to do the post i get this error: SyntaxError: Unexpected end of JSON input.
I’ve been figuring out for two straight days and have no absolute clue what is causing this error. I have tried a lot of codes( CORS, json.text(), etc) and nothings seems to fix this error.
Does anyone have fixed this error? please help me.
The repo is on:
GitHub - carlosfpj/equipment-designer at production
Thank you so much
Thanks for your response Jason.
i will check what you said, nevertheless I’m quite surprised on my localhost worked, i mean, i receive the proper response back from the server without any problems.
I thought about the asyncronity , so y typed async/await acordingly and i’m still facing this error.
Do you know any tools to check the content of the server response?
Thank you!
Hello Jason.
I took your advice and used Postman and ThunderClient to send requests to my backend, I fixed some routes stuff and it works perfect, the response comes as I expect (Json or text format, tested both).
Sadly, when I test the request and response in the browser with my render static-site I’m still getting the same error “SyntaxError: Unexpected end of JSON input” in this line in my React component:
const resJson = await res.json();
I was checking this community forum and found someone who had the exact same issue like me, the thread is in the following link:
I have built a Full-stack MERN (React + Node.js + MongoDB) Note taking application. After ensuring both frontend and backend apps were working properly on my local machine, I decided to deploy them on Render.
I first deployed the backend to Render, and when I tried to connect my local frontend app with the deployed backend app, it worked great. I could perform actions like Sign up/Log in without any issues.
Then I deployed my frontend app on Render as well (here’s the web app -
https://notes-a…
As he mentions, he changed some stuff on his proxy on the frontend package json, unfortunately he doesn’t specify what actually did he change. I asked gemini and google what is that proxy but i don’t understand quite well what is the purpose of that proxy in order to know if that’s where my error comes from.
I also tried to contact him on this forum but i guess it is not possible, there is no way to land messages between members, could be a future feature, perhaps.
.
Jason, do you have any clue or any blog where I can read about this proxy thing and figure this out?
Thanks in advance.
Carlos.