Next.js App Fails to Start Due to Out of Memory (OOM) After Successful Build


Q1. during this push was an Out of Memory (OOM) crash during the application’s initialization phase on Andasy. but initial build process appeared successful in the CLI :thinking:, So as a developer what can you do :upside_down_face:?? I was pushing Next.js project and Next.js required more memory than the default 256MB allocated to my app, causing the process to be killed by the system.

Answer is this Guyz: modifying the andasy.hcl configuration file to increase the memory limit to 1024MB (1GB)

Q2. for those guyz who failed with project which contains IMAGES.

Answer is this is where Docker was definitely used .
Step1: During the andasy setup step, the CLI detected your Next.js project and automatically created a Dockerfile in your FRONTEND/web directory.
Step2: When I ran andasy deploy, that Dockerfile was sent to the remote builder we found earlier (walruses-rouse-rawdon). This “Builder” is actually a Docker environment that compiled your code into a container image.

And I guess if U’ll increase the memory, the Docker will be killed!(I guess). And this is my Question Docker will be killed or remain work with that memory?

Blockquote

Hello Shami,

Next.js requires additional memory at startup because the image runs an optimization build before the application starts. There are two ways to address this:

  1. Update your entrypoint.js to remove the build step:
    npx next build --experimental-build-mode generate, or
  2. Increase the memory allocated to the app by editing your andasy.hcl file.

Because the failure occurred during application initialization, the build was reported as successful. However, when the orchestrator attempted to start the app, it crashed due to insufficient memory, which is why the deployment output indicates that the application did not come up successfully.

1 Like

It works! Thanks for your Support :pray: :pray: