Hi team I m getting a
Hi team! I'm getting a
Failed: build exceeded memory limit and was terminated
I have been moving some pages and components to work on the app dir instead on the pages dir. All our previous builds were running ok.15 Replies
I have build cache enabled and using the version 2 of the build system.
Previous deployments were taking 3m30s and this one is taking 5m plus and it then breaks the build.
and running npx @Cloudflare/next-on-pages in local goes smoothly.
Uhm. I have added next-on-pages as dependency and it went well...
And a new change and went wrong again...
Failed: build exceeded memory limit and was terminated
Hi, this is interesting, it's been a while since I've seen someone run into this. Are you able to see at what point in the build it fails in the build log?
I don’t see any logs further than the warning about installing “can-i-use”.
Sounds like it might be an issue with when Next.js itself is building then
You could try changing the node_options env for the build environment -
NODE_OPTIONS="--max-old-space-size=8192"
I'm trying:
There is a warning, though:
Warning: Specified NODE_OPTION --max_old_space_size value is higher than allowed - setting to 7620
And these are the lines that I got when running npx cloudflare/next-on-pages
I wonder if Next.js has a memory leak maybe, since this is only happening when you try to move to the app dir
I was wondering the same, also several components are now server components... might that be the issue... let me try and add some use clients everywhere...
And we already had some pages, components and routes in the app folder.
Tried with use client and same thing... worries me.
:/
There is definitely something to do with the compilation/building
It did compile once and the output was
So, there may be things to do with some Clerk stuff and the app folder.
I don't know anymore. I got 1 deployment that goes OK, and then several that don´t finish.
There was a similar bug recorded in https://github.com/cloudflare/next-on-pages/issues/309
GitHub
[🐛 Bug]: Failed: build exceeded memory limit and was terminated · I...
next-on-pages environment related information node v: v18.16.0 Description I have a large project and migrating Cloudflare, Trying to deploy to Cloudflare pages but while building the application I...
The difference here is he was running into the problem after Next.js/Vercel had finished building, which meant it was us doing too much stuff in-memory, whereas yours seems like it's happening when Next.js builds
Yup, that's right, it is different on that regard. I have no visibity on what Next/Vercel do when building it... :sad:
Whats supposed to be my output? Putting.next just gives me a empty webpage on compile
.vercel/output/static is the default output directory when you use next-on-pages
Thank you, for this solution
It has worked for me, and it seems like pages works perfectly for my use case