Skip to content

Box resource limits: next build EAGAIN — can't spawn workers in 2GB RAM #104

@shtefcs

Description

@shtefcs

Problem

Running `next build` inside an Upstash Box fails with `EAGAIN` (resource temporarily unavailable) during static page generation. The build tries to spawn Node.js worker processes but the 2GB RAM limit prevents process creation.

Error

```
Warning: Failed to load system CA certificates off thread: resource temporarily unavailable
uncaughtException [Error: spawn /usr/local/bin/node EAGAIN] {
errno: -11,
code: 'EAGAIN',
syscall: 'spawn /usr/local/bin/node'
}
```

This happens during `Generating static pages` — Next.js spawns worker processes (1 per CPU core) and the box runs out of memory/process slots.

Environment

  • `@upstash/box`: 0.1.28
  • Runtime: node
  • Next.js: 15.1.7
  • Build tool: @opennextjs/cloudflare (which calls `next build` internally)

Workaround

Setting `NODE_OPTIONS="--max-old-space-size=1536"` before the build limits each Node.js process's heap and prevents the EAGAIN crash. But this is fragile — larger projects may still exceed 2GB total.

Request

  1. Documentation: What are the exact resource limits per box? (RAM, max processes, CPU cores, file descriptors)
  2. Larger box tiers: Is there a plan for 4GB or 8GB boxes? Build tools like Next.js, Vite, and Webpack are memory-intensive — 2GB is tight for production builds.
  3. Process limits: The EAGAIN error might also be caused by a process count limit (`ulimit -u`). What's the configured limit?

Steps to Reproduce

  1. Create a box with `runtime: "node"`
  2. Scaffold a Next.js project with 5+ pages
  3. Run `next build` (or `npx opennextjs-cloudflare build`)
  4. Build crashes during "Generating static pages" with EAGAIN

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions