Skip to content

Build container ran out of memory

0

I'm deploying a Next.js 14 application with AWS Amplify Gen2, but the builds consistently fail with the error: "Build container ran out of memory".

As suggested in the AWS documentation, I removed .next/cache/**/* from the cache.paths section of my amplify.yml file. I also increased the NODE_OPTIONS environment variable to allocate more memory but that doesn't seem to help

Below is my current amplify.yml configuration:

version: 1
backend:
  phases:
    build:
      commands:
        - corepack enable
        - pnpm install --frozen-lockfile
        - pnpm exec ampx pipeline-deploy --branch $AWS_BRANCH --app-id $AWS_APP_ID
frontend:
  phases:
    build:
      commands:
        - export NODE_OPTIONS="--max-old-space-size=12288"
        - pnpm run build
  artifacts:
    baseDirectory: .next
    files:
      - '**/*'
  cache:
    paths:
      - node_modules/**/*

asked 2 years ago2K views

1 Answer
2

Hi,

You're facing a known issue: https://github.com/aws-amplify/amplify-hosting/issues/654

Please, read this ticket in details: some folks propose workarounds / solution that may also work for your use case.

Best,

Didier

EXPERT

answered 2 years ago

EXPERT

reviewed 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.