Build Failed: build exceeded memory limit and was terminated

I tried the same by increasing --max-old-space-size=8192 but deployment continued to have the same error as stated. |14:08:46.399|Success: Finished cloning repository files| |14:18:58.679|Failed: build exceeded memory limit and was terminated| Deployment id: 9aff3dcd-9f38-4002-93db-5020409e5a8b node: 18.17 Would appreciate any help. It's quite urgent.
46 Replies
Vero
Veroβ€’3w ago
Hey, 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 experimental.cpus: 4. - 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.) Please let me know if this doesn't fix the issue
Rishabh Pachori
Rishabh Pachoriβ€’3w ago
@Vero πŸ™ I have added experimental.cpus: 4 in next.js config. Also added NODE_OPTIONS=--max-old-space-size=3072 in env Error occured while creating build: FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory Failed: Error while executing user command. Exited with error code: 1 Failed: build command exited with code: 1 Failed: error occurred while running build command Still not resolving the issue ?? @Vero πŸ™ After that i increased this NODE_OPTIONS=--max-old-space-size=3072 to NODE_OPTIONS=--max-old-space-size=7620 Error occured: 10:48:16.537 Failed: build exceeded memory limit and was terminated Could you please suggest something else which i can try to resolve this issue @Vero πŸ™ can you please suggest something
Vero
Veroβ€’3w ago
you should actually decrease this, Pages builds get ~8GB of memory for building their projects
Rishabh Pachori
Rishabh Pachoriβ€’3w ago
@Vero πŸ™ i have used 3072 but it is showing the above error which i mentioned. Can you suggest me what memory i can use ?? Or if you have any other approach to resolve this issue @Vero πŸ™ Can you please look on this issue?? Its quite urgent for me to resolve this issue
Vero
Veroβ€’3w ago
Could you please send me your account ID?
Rishabh Pachori
Rishabh Pachoriβ€’3w ago
@Vero πŸ™ Sure..!! This is my account Id 3e36494bda5757430bacf51c02628219 @Vero πŸ™ Please check it
Vero
Veroβ€’3w ago
I actually need your pages zone, sorry, can you tell me which Pages zone specifically?
Amr Yasser
Amr Yasserβ€’3w ago
same problem here, the local pages build works seamlessly but the deployment gives the above error
Vero
Veroβ€’3w ago
Have you reduced the node memory already? also can you please tell me more about your use case, what kind of project are you building?
Amr Yasser
Amr Yasserβ€’3w ago
yes, here is the error FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory I am trying to deploy a fullstack next.js app with D1 binding
Vero
Veroβ€’3w ago
ok then can you also please send me your Pages zone?
Amr Yasser
Amr Yasserβ€’3w ago
where can I find the zone?
Vero
Veroβ€’3w ago
It should be under your Pages project in the overview. It's your pages domain, something like <YOUR_SITE>.pages.dev
Amr Yasser
Amr Yasserβ€’3w ago
wodge.pages.dev
Vero
Veroβ€’3w ago
Great, thanks. Can you please also share the ID of the deployment where you're getting this error?
Amr Yasser
Amr Yasserβ€’3w ago
main 3e52559
Vero
Veroβ€’3w ago
Can you please check again? deployment IDs are different. Usually you can find the ID after the error, something like this: |14:18:58.679|Failed: build exceeded memory limit and was terminated| Deployment id: 8sdh3ufu-1r83-2034-43db-7323742e5a7e
Amr Yasser
Amr Yasserβ€’3w ago
can't find it here are the lines from the begining of the error <--- Last few GCs ---> 19:24:26.652 β–² 19:24:26.652 β–² [1093:0x573c3a0] 91729 ms: Scavenge (reduce) 3059.1 (3096.2) -> 3058.5 (3096.4) MB, 2.2 / 0.0 ms (average mu = 0.189, current mu = 0.004) allocation failure; 19:24:26.652 β–² [1093:0x573c3a0] 92446 ms: Mark-sweep (reduce) 3059.3 (3096.4) -> 3058.6 (3096.7) MB, 716.0 / 0.0 ms (average mu = 0.106, current mu = 0.018) allocation failure; scavenge might not succeed 19:24:26.652 β–² 19:24:26.652 β–² 19:24:26.652 β–² <--- JS stacktrace ---> 19:24:26.652 β–² 19:24:26.652 β–² FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory 19:24:26.653 β–² 1: 0xb83f50 node::Abort() [node] 19:24:26.653 β–² 2: 0xa94834 [node] 19:24:26.654 β–² 3: 0xd647c0 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [node] 19:24:26.654 β–² 4: 0xd64b67 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [node] 19:24:26.655 β–² 5: 0xf42265 [node] 19:24:26.656 β–² 6: 0xf43168 v8::internal::Heap::RecomputeLimits(v8::internal::GarbageCollector) [node] 19:24:26.656 β–² 7: 0xf53673 [node] 19:24:26.657 β–² 8: 0xf544e8 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node] 19:24:26.658 β–² 9: 0xf2ee4e v8::internal::HeapAllocator::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node] 19:24:26.658 β–² 10: 0xf30217 v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node] 19:24:26.659 β–² 11: 0xf113ea v8::internal::Factory::NewFillerObject(int, v8::internal::AllocationAlignment, v8::internal::AllocationType, v8::internal::AllocationOrigin) [node] 19:24:26.660 β–² 12: 0x12d674f v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [node] 19:24:26.661 β–² 13: 0x17035b9 [node] 19:24:26.877 β–² Aborted 19:24:26.880 β–² ELIFECYCLE  Command failed with exit code 134. 19:24:26.917 β–² Error: Command "pnpm run build" exited with 1 19:24:28.107 19:24:28.108 ⚑️ The Vercel build (pnpm dlx vercel build) command failed. For more details see the Vercel logs above. 19:24:28.108 ⚑️ If you need help solving the issue, refer to the Vercel or Next.js documentation or their repositories. 19:24:28.108 19:24:28.132  ELIFECYCLE  Command failed with exit code 1. 19:24:28.158 Failed: Error while executing user command. Exited with error code: 1 19:24:28.169 Failed: build command exited with code: 1 19:24:29.068 Failed: error occurred while running build command
Vero
Veroβ€’3w ago
?pages-deployment-id
Flare
Flareβ€’3w ago
The Pages deployment ID is a unique build identifier. It's the UUID in the browser bar (for example, a URL would be dash.cloudflare.com/ACCOUNT_ID/pages/view/PROJECT/DEPLOYMENT_ID where the deployment ID looks something like a398d794-7322-4c97-96d9-40b5140a8d9b). This ID can help troubleshoot some issues with Pages builds so if you have a failing build make sure you grab that ID for the team to use.
Vero
Veroβ€’3w ago
You can find it in your URL ^
Amr Yasser
Amr Yasserβ€’3w ago
here it is 31fa2d57-4948-4d7f-85b2-d11d890e6913
Vero
Veroβ€’3w ago
Thanks, I've passed this internally Also passed yours @Rishabh Pachori but please tell me more about your use case when you can
Amr Yasser
Amr Yasserβ€’3w ago
Thank you, do you have an estimate on how long will it take?
Vero
Veroβ€’3w ago
No. Pages projects builds get 8GB of memory, we'll try to increase this for you, but this isn't something we usually do. Also, I've already ended my shift so don't expect a response today, will give you an update tomorrow πŸ™‚
Rishabh Pachori
Rishabh Pachoriβ€’2w ago
@Vero I am trying to deploy a fullstack next.js app Account id : 3e36494bda5757430bacf51c02628219 Zone: zn1.pages.dev Deployment id: 9aff3dcd-9f38-4002-93db-5020409e5a8b Deployment Id: 3a48cf05-d691-4f2a-9c48-a8b3e3a9e271 node: 18.17 @Vero I am deploying a Next.js full stack application staging app in cloudflare. Soon in the next 2 -3 weeks i will deploy a production application too in cloudflare. This application conatins chat application, CRM management, Event management. So almost initially we got thousands of users who will be using it on daily basis after we launch it in production. I am afraid for this staging app you increase this limit this time. For production app i need to connect with you again for this issue ?? @Vero Any update for the above issue ??
Walshy
Walshyβ€’2w ago
It was escalated to the team It's awaiting them, an update will be given when there is one
Rishabh Pachori
Rishabh Pachoriβ€’2w ago
@Vero @Walshy | Deploying Do you have an estimate on how long will it take from your end?
Walshy
Walshyβ€’2w ago
No, Eng team may take a day or may take a week. We don't know and all we can do is wait.
Amr Yasser
Amr Yasserβ€’2w ago
sorry for repeatedly asking but it is critical, any updates?
Walshy
Walshyβ€’2w ago
Still waiting on the Eng team It's the weekend now so they aren't working either @Vero can give them a nudge on Monday
Rishabh Pachori
Rishabh Pachoriβ€’2w ago
@Vero πŸ™ any update for the same ??
Vero
Veroβ€’2w ago
The team just created a PR for this but it's pending review This should be fixed now. Could you please try building you projects again? @Rishabh Pachori @Amr Yasser
Rishabh Pachori
Rishabh Pachoriβ€’2w ago
Sure. I am checking it @Vero πŸ™ I have checked it. Its working now. I will be monitor it for 2 -3 days and will let you know if i get any issue. @Vero πŸ™ As i told you i will create one more project for production environment in the next week. is there any configuration i need to do at my end before deploying it that you have suggested to me in above message. Please let me know do i need to set NODE_OPTIONS at all ??? or set experimental cpus at all in next.js config. Thankyou for the help.πŸ˜€
Vero
Veroβ€’2w ago
If you run into memory issues again (which is unlikely), you can add those flags again, but it's probably unnecessary to use those flags now
Amr Yasser
Amr Yasserβ€’2w ago
still does not work form me FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory note that manual deployment works
Amr Yasser
Amr Yasserβ€’2w ago
and the cpus are 4 in next.config.js
No description
No description
Vero
Veroβ€’2w ago
can you please remove that flag? and check if it works
Amr Yasser
Amr Yasserβ€’2w ago
it does not the deployment before this one was without the flag
Vero
Veroβ€’2w ago
are you using this flag also: NODE_OPTIONS? It shouldn't be necessary anymore
Amr Yasser
Amr Yasserβ€’2w ago
ok I will try without it It works now, thank you!
Vero
Veroβ€’2w ago
awesome!
Amr Yasser
Amr Yasserβ€’5d ago
Follow-up: it is not stable, now I tried a new deployment it does not work at first, and when I run a retry it worked 7b36de0d-0756-4026-b433-54452cd042aa deployment id Update: It is totally broken now 37a2403f-9c2e-49ec-9604-c7cf3cece27e @Vero πŸ™
Vero
Veroβ€’3d ago
can you please try adding this flag again? NODE_OPTIONS=--max-old-space-size Lets try NODE_OPTIONS to--max-old-space-size=5120 first, then if that doesn't work, try increasing to NODE_OPTIONS to--max-old-space-size=8192
Amr Yasser
Amr Yasserβ€’3d ago
I did , It is stable and working now
Vero
Veroβ€’3d ago
Great
Want results from more Discord servers?
Add your server
More Posts