Hi Cloudflare Community,
My company has been deploying our react frontend for the past two years via Cloudflare pages. All day yesterday and today, all of a sudden, our builds fail with Failed: build exceeded memory limit and was terminated
There was no major infastructure changes in this release. We are using node version 14.21.3
Do you have any feedback on why this would be happening? It builds fine locally.
Can you please provide a deployment ID for one of the failed builds?
Thanks for the response.
Assuming that the deployment id can be taken from the URL,
Here are few that failed:
We’re experiencing the same problem with many of our latest builds for the last two days:
The first instance of our failing builds happened on
2024-01-08T21:16:36.135529Z. We haven’t had a successful build since.
that timeline matches up with what we’re experiencing
Thank you. We recently upgraded our infrastructure which gives builds significantly increased disk IO. It looks like a small number of projects are consuming more memory as a result.
Here are some things that may help:
- Reduce concurrency settings in your build (if applicable.) Eg. next.js defaults to 7 threads that can be overridden by specifying
- Reduce Node memory by specifying an environment variable:
NODE_OPTIONS=--max-old-space-size=3072 (if you’re setting this elsewhere already, then change it there instead.)
I know this is frustrating and appreciate your patience.
Thanks for the response. However, that doesn’t seem to have fixed the issue.
I added Variable Name:
NODE_MODULES and Value:
--max-old-space-size=3072 to my preview environmental variables. I re-deployed a feature branch and got the same error.
I then edited the package.json from
react-scripts build to
node --max-old-space-size=3072 node_modules/.bin/react-scripts build with the same result.
Here are those 2 deployments:
Wanted to give some more feedback:
- I am not aware of any concurrecny setting using react-scripts. This appears to be for next.js and therefore have not experimented with experimental.cpus
- I’ve tried using environmental variables with the titles
NODE_MODULES per your previous comment and
NODE_OPTIONS from some other references. Both resulted in the same memory error with values of
- Our build command also included sentry source mapping. I’ve removed this thinking that it could be taking up too much memory, but still get the same memory error.
- I tried dropping the max memory from 3072 to 2048. Locally, 2048MB is sufficient to build this project but still get the same error on cloudflare builds.
Do you have other suggestions to get this thing built? Many thanks! Jacob
I was able to get this to build. But it’s really odd, because I could only do it with BOTH of these env vars. Using just one would not work
Apologies @jacob25 - I meant
NODE_MODULES. Great catch there. I updated my previous reply for clarity.
@colin.hoernig can you give your builds another try? I’ve opted you out of the infrastructure upgrade.
Looks like builds started succeeding corresponding with you opting us out of the infrastructure change. Thank you!
hi @jhands1 @jfawcett
After working Wed and Thursday, all of our builds this morning are failing with the same memory error in this title.
I’ve tried to systematically increase the
NODE_OPTIONS=--max-old-space-size=8192 all with the same result.
We did get a message at 8192 that memory usage was capped at 76XX MB.
Is there a way to resolve this issue? Revert to the infrastructure like you did with colin? We can adjust our cloudflare plan to get more memory as well. We just want these builds to start working again. Thanks!
Examples of failures:
Hey there @jacob25 I’ve gone ahead and opted you out. Could your build again?
Yes, that worked!!!
Thanks so much for your help @jfawcett
@jfawcett Hello, I also encountered this problem in my project. Can you also help me exit the infrastructure upgrade? This is the deployment id: b239e565-2e26-459b-ae3f-9e1fff07b184
hi @jfawcett @jfawcett
My project started last week and the same build failed with the same memory error as this title.
I also tried increasing all NODE_OPTIONS=–max-old-space-size=2048 and NODE_OPTIONS=–max-old-space-size=8192 with the same result.
Is there a way to solve this problem? Or will my project be rolled out to upgrade infrastructure? I can also adjust the cloudflare plan to get more memory. We just want these builds to start working again. Thanks!
This is the deployment id: b239e565-2e26-459b-ae3f-9e1fff07b184
@jhands1 @jfawcett can you see it？