" Cannot GET / " error when deploying create react app with server

I’m attempting to migrate my webapp from Heroku to Render. I have a create-react-app that I’m using with a node express server. I’ve done all the setup from docs and I see on the dashboard logs that my webservice is up and is listening on a port. When I click on the link, I get the Cannot Get /.

I’m confused because my server file has that get request handled and should be serving my build folder.

Any thoughts or ideas on how to proceed troubleshooting this issue? I want to know if its with my code or a setting on render that I need to adjust. I’m convinced its a simple fix.

I’m willing to share code, examples, and screenshots so I learn more about render and the deployment process.

Here is my url: https://cosmoboard.onrender.com/

Hi Jacob,

Thanks for reaching out.

Are you trying to serve static/generated files through Express? Sometimes I’ve seen Cannot GET / in that case when you’re not requesting the generated filename, e.g. my-site.onrender.com/my-file.html.

If it’s a completely static site, it’s probably a better fit for a Render Static Site, which are free. Our static React guide is here: https://render.com/docs/deploy-create-react-app Our example uses yarn, but if you used npm locally, change the build command as required.

Hope that helps, please let us know if we can assist any further.

Alan

Hi Alan,

Thank you for your insight. I believe that is the solution to my original GET/ problem. However, a new problem has arisen and appears to be relevant: I am using an express server in a standalone file server.js that is outside my Build folder. It contains the relevant API calls and .env variables.

I believe I can use a static site setup for my needs, but when I input the following into my static site build command portion: " npm run build; node server.js; " The static site is forever at the stage of deploying. Example Picture:

It was because of this problem that I then attempted to use the Web Service option, as that appeared to actually finish deploying after the server starts up.

My question is this: Is it possible for me to have my own server using express on the static website option? Or do I need to use the Web Service option?

It’s also possible I’m going about this in a very weird and awkward way and need to rewrite my code so the express server is not it’s own standalone file.

I’m wanting to learn more about Render and its process. I’m moving over from Heroku as their free tier is gone in November and Render seems like a great place to be. Looking forward to next response.

Thank you,

Jake

Actually Alan I was continuing my experiments with the Web Service Option and was able to get my app working with the server file and was able to answer my own question.

Thank you regardless as your input led me to the thought process I was needing to find the solution.

This is real neat!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.