Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

USING GCP with React app deployment

When I deploy my react js app into cloud run I found error returned FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory

I set NODE_OPTIONS with max-old-space but still not working ,

is there way to do this with cloud run dashboard 

Solved Solved
0 2 397
1 ACCEPTED SOLUTION

Hi @Ahmed_Samir

Welcome to Google Cloud Community!

I understand that you are getting an error when trying to deploy ReactJS into Cloud Run. May I know how you set the NODE_OPTIONS="--max-old-space-size=<MB>" flag? Also, you can try to gradually increase the memory size of it. This error usually occurs when the NodeJS process runs out of memory.

Regarding if there is a way to do this on Cloud Run. What you can do is to try to gradually increase the memory allocated to instances of the container from 512MB to 4GB. But, please take note also that increasing the memory will increase the pricing of your Cloud Run service.

I hope the above information is helpful.

View solution in original post

2 REPLIES 2

Hi @Ahmed_Samir

Welcome to Google Cloud Community!

I understand that you are getting an error when trying to deploy ReactJS into Cloud Run. May I know how you set the NODE_OPTIONS="--max-old-space-size=<MB>" flag? Also, you can try to gradually increase the memory size of it. This error usually occurs when the NodeJS process runs out of memory.

Regarding if there is a way to do this on Cloud Run. What you can do is to try to gradually increase the memory allocated to instances of the container from 512MB to 4GB. But, please take note also that increasing the memory will increase the pricing of your Cloud Run service.

I hope the above information is helpful.

Hi @ronnelg 
I set it as NODE_OPTIONS="--max-old-space-size=<MB> into trigger Yaml file and into app service yaml file , didn't work 

so I found the solution to set it into package.json into build command  as "--max-old-space-size=<MB>" directly without NODE_OPTIONS , after investigation I found that NODE_OPTIONS=--max-old-space-size=<MB> not working into linux