Haven't been able to build Nextjs app since around a day ago: ERR_WORKER_OUT_OF_MEMORY

As noted in the title, our Nextjs app stopped being able to be built a day ago or so, each time we try to build it, it gives: ERR_WORKER_OUT_OF_MEMORY The full error looks something like this:
#12 ERROR: process "/bin/bash -ol pipefail -c pnpm run build" did not complete successfully: exit code: 1

-----

> [stage-0 8/10] RUN --mount=type=cache,id=s/ea06edaa-db43-4e96-8e97-988165650a07-next/cache,target=/app/.next/cache --mount=type=cache,id=s/ea06edaa-db43-4e96-8e97-988165650a07-node_modules/cache,target=/app/node_modules/.cache pnpm run build:

30.19 ~/_next/server/webpack-runtime.js.map

39.82 Warning: For production Image Optimization with Next.js, the optional 'sharp' package is strongly recommended. Run 'npm i sharp', and Next.js will use it automatically for Image Optimization.

39.82 Read more: https://nextjs.org/docs/messages/sharp-missing-in-production

109.3 uncaughtException Error [ERR_WORKER_OUT_OF_MEMORY]: Worker terminated due to reaching memory limit: JS heap out of memory

109.3 at new NodeError (node:internal/errors:405:5)

109.3 at [kOnExit] (node:internal/worker:287:26)

109.3 at Worker.<computed>.onexit (node:internal/worker:209:20) {

109.3 code: 'ERR_WORKER_OUT_OF_MEMORY'

109.3 }

112.0  ELIFECYCLE  Command failed with exit code 1.

-----

Dockerfile:30

-------------------

28 | # node:build phase

29 | COPY . /app/.

30 | >>> RUN --mount=type=cache,id=s/ea06edaa-db43-4e96-8e97-988165650a07-next/cache,target=/app/.next/cache --mount=type=cache,id=s/ea06edaa-db43-4e96-8e97-988165650a07-node_modules/cache,target=/app/node_modules/.cache pnpm run build

31 |

32 |

-------------------

ERROR: failed to solve: process "/bin/bash -ol pipefail -c pnpm run build" did not complete successfully: exit code: 1



Error: Docker build failed
#12 ERROR: process "/bin/bash -ol pipefail -c pnpm run build" did not complete successfully: exit code: 1

-----

> [stage-0 8/10] RUN --mount=type=cache,id=s/ea06edaa-db43-4e96-8e97-988165650a07-next/cache,target=/app/.next/cache --mount=type=cache,id=s/ea06edaa-db43-4e96-8e97-988165650a07-node_modules/cache,target=/app/node_modules/.cache pnpm run build:

30.19 ~/_next/server/webpack-runtime.js.map

39.82 Warning: For production Image Optimization with Next.js, the optional 'sharp' package is strongly recommended. Run 'npm i sharp', and Next.js will use it automatically for Image Optimization.

39.82 Read more: https://nextjs.org/docs/messages/sharp-missing-in-production

109.3 uncaughtException Error [ERR_WORKER_OUT_OF_MEMORY]: Worker terminated due to reaching memory limit: JS heap out of memory

109.3 at new NodeError (node:internal/errors:405:5)

109.3 at [kOnExit] (node:internal/worker:287:26)

109.3 at Worker.<computed>.onexit (node:internal/worker:209:20) {

109.3 code: 'ERR_WORKER_OUT_OF_MEMORY'

109.3 }

112.0  ELIFECYCLE  Command failed with exit code 1.

-----

Dockerfile:30

-------------------

28 | # node:build phase

29 | COPY . /app/.

30 | >>> RUN --mount=type=cache,id=s/ea06edaa-db43-4e96-8e97-988165650a07-next/cache,target=/app/.next/cache --mount=type=cache,id=s/ea06edaa-db43-4e96-8e97-988165650a07-node_modules/cache,target=/app/node_modules/.cache pnpm run build

31 |

32 |

-------------------

ERROR: failed to solve: process "/bin/bash -ol pipefail -c pnpm run build" did not complete successfully: exit code: 1



Error: Docker build failed
Our project ID is 82091a0b-2976-40b9-bb0f-784a7f99567f
2 Replies
Percy
Percy7mo ago
Project ID: ea06edaa-db43-4e96-8e97-988165650a07,ea06edaa-db43-4e96-8e97-988165650a07,ea06edaa-db43-4e96-8e97-988165650a07,ea06edaa-db43-4e96-8e97-988165650a07,82091a0b-2976-40b9-bb0f-784a7f99567f
Brody
Brody7mo ago
first off I'd try having sharp as a dependency