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
Eusebio Trigo
Eusebio TrigoOP14mo ago
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
James
James14mo ago
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?
Eusebio Trigo
Eusebio TrigoOP14mo ago
I don’t see any logs further than the warning about installing “can-i-use”.
James
James14mo ago
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"
Eusebio Trigo
Eusebio TrigoOP14mo ago
I'm trying: There is a warning, though: Warning: Specified NODE_OPTION --max_old_space_size value is higher than allowed - setting to 7620
17:24:03.298 ▲ npx browserslist@latest --update-db
17:24:03.298 ▲ Why you should do it regularly: https://github.com/browserslist/browserslist#browsers-data-updating
17:28:01.034 Failed: build exceeded memory limit and was terminated
17:24:03.298 ▲ npx browserslist@latest --update-db
17:24:03.298 ▲ Why you should do it regularly: https://github.com/browserslist/browserslist#browsers-data-updating
17:28:01.034 Failed: build exceeded memory limit and was terminated
And these are the lines that I got when running npx cloudflare/next-on-pages
▲ Why you should do it regularly: https://github.com/browserslist/browserslist#browsers-data-updating
▲ ✓ Compiled successfully
▲ Linting and checking validity of types ...
▲ Why you should do it regularly: https://github.com/browserslist/browserslist#browsers-data-updating
▲ ✓ Compiled successfully
▲ Linting and checking validity of types ...
James
James14mo ago
I wonder if Next.js has a memory leak maybe, since this is only happening when you try to move to the app dir
Eusebio Trigo
Eusebio TrigoOP14mo ago
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.
James
James14mo ago
:/
Eusebio Trigo
Eusebio TrigoOP14mo ago
There is definitely something to do with the compilation/building It did compile once and the output was
11:53:14.166 ▲ ⚠ Compiled with warnings
11:53:14.170 ▲ ./node_modules/@clerk/shared/dist/esm/utils/localStorageBroadcastChannel.js
11:53:14.170 ▲ A Node.js API is used (MessageEvent at line: 26) which is not supported in the Edge Runtime.
11:53:14.170 ▲ Learn more: https://nextjs.org/docs/api-reference/edge-runtime
11:53:14.166 ▲ ⚠ Compiled with warnings
11:53:14.170 ▲ ./node_modules/@clerk/shared/dist/esm/utils/localStorageBroadcastChannel.js
11:53:14.170 ▲ A Node.js API is used (MessageEvent at line: 26) which is not supported in the Edge Runtime.
11:53:14.170 ▲ Learn more: https://nextjs.org/docs/api-reference/edge-runtime
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.
Eusebio Trigo
Eusebio TrigoOP14mo ago
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...
James
James14mo ago
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
Eusebio Trigo
Eusebio TrigoOP14mo ago
Yup, that's right, it is different on that regard. I have no visibity on what Next/Vercel do when building it... :sad:
sha386
sha38611mo ago
Whats supposed to be my output? Putting.next just gives me a empty webpage on compile
James
James11mo ago
.vercel/output/static is the default output directory when you use next-on-pages
sha386
sha38611mo ago
Thank you, for this solution It has worked for me, and it seems like pages works perfectly for my use case
Want results from more Discord servers?
Add your server