React-Scripts and Over RAM Usage

Hi there, I’ve just started to use Render as I’m migrating from Heroku. I’ve managed to migrate most of my API services, and barring a few simple hiccups, everything is working well.

Now I have an issue when I’m trying to migrate a very small react app. It’s a simple one page website that uses react-scripts to build and deploy itself, and according to the logs, the react-scripts start script is taking too much RAM (I’m receiving the Unhealthy Service, more then 512Mb of RAM used).

I was wondering if someone could help me understand the issue since before I was running this react app on Heroku’s hobbist plan, and that should also have a limiter of 512Mb of RAM, so I’m a bit confused as to why I’m receiving this error on Render considering there have been little to no code changes.

Below is a picture of the log I am receiving on start, I apologize if this does not give much to go on, but I’ll appreciate any piece of information that might point me to the right direction. Thanks!

That’s a really weird error. I’d check to make sure the code is running with the same version of Node as ran on Heroku or locally for you. I’d also search for that particular error at that location. Maybe it’s memory related, but it’s hard to say.

It’s easy to switch to the Starter Plus plan and then back down — you could test it w/ 1G RAM and see if that actually fixes it.

Hi there,

Thanks for reaching out.

What I’m noticing there is “Starting the development server…”, which will be trying to rebuild assets on the fly, etc. on the runtime instance, which can be quite intensive for the low CPU/RAM available. It feels like the deploy needs to be made production-ready by building everything at build time and then serving it through Express, or something similar at runtime.

Maybe you were using the create-react-app-buildpack on Heroku which puts simple React apps behind nginx? The official Create React App user guides have some docs on deployment, which may be worth a look.

If the React app is completely static maybe a Render Static Site would be a better fit?

Hope that helps, please let us know if you have any more questions.

Alan

1 Like

Hey there, thanks for the prompt reply. As for the Node Version I’m sure it’s the same version since I used the “engines” key in the package.json to set it to the exact same version I use on my Docker dev container. I might just switch just to check if it trully is just a memory issue though thanks for the suggestion!

Hi there. I’ll be giving the Create React App guides a look because truth be told, I usually more often use Next.js to build React Applications, but this being a particularly tiny project, it felt like overkill. That said what you mentioned about the Static Site has crossed my mind. I’ll give setting it as a Static Site a go first. Thanks very much for your help!

Just thought I might let you know, I moved to a Static Site and it worked with no problems. Thank you so much!