Failed to build due to out of memory issues for Next JS app

Hi,

I have specified my node version as 18.0.0 and --max-old-space-size=16384 but I still get these errors on building.

Ran out of memory (used over 8GB) while building your code.
May 9 01:43:43 AM  info  - Creating an optimized production build...
May 9 01:43:45 AM  Browserslist: caniuse-lite is outdated. Please run:
May 9 01:43:45 AM    npx browserslist@latest --update-db
May 9 01:43:45 AM    Why you should do it regularly: https://github.com/browserslist/browserslist#browsers-data-updating
May 9 01:43:45 AM  [@Sentry/nextjs] You are using Next.js features that run on the Edge Runtime. Please add a “sentry.edge.config.js” or a “sentry.edge.config.ts” file to your project root in which you initialize the Sentry SDK with “Sentry.init()“.
May 9 01:43:50 AM  Browserslist: caniuse-lite is outdated. Please run:
May 9 01:43:50 AM    npx browserslist@latest --update-db
May 9 01:43:50 AM    Why you should do it regularly: https://github.com/browserslist/browserslist#browsers-data-updating
May 9 01:48:17 AM  info  - Compiled successfully
May 9 01:48:17 AM  info  - Collecting page data...
May 9 01:53:35 AM  Killed
May 9 01:53:36 AM  ==> Build failed :disappointed:

This issue does not appear to have been solved yet so I have contacted support as well.

I am on the 16 GB instance and I wonder if there’s any way to increase the build container memory as well.

Related thread: The "next build" always fails at the "Collecting page data..." stage - #4 by al_ps

Hi Luke,

One thing to note is upgrading the instance type only changes the run time specs. Build containers are the same regardless and are currently limited to 8 GB of memory. We do have this existing feature request I’d encourage you to upvote https://feedback.render.com/features/p/more-powerful-build-machines.

If you can make any changes to your build process to optimize for memory consumption, I’d start there.

I’ll also follow up with you in your support ticket with more information specific to your service.

Best,

Matt

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.