# Diagnose deployment failures for Next.js

Diagnose a failed Next.js deployment on Ample. Deploy is synchronous: a failed next build returns build_failed with the deployment id, and ample logs exposes the build log and then the runtime log so the cause is read, not guessed.

**Verified** November 6, 2026

## What it runs on

- [Computeverified](/content/discover/primitive/compute/index.html)  
  Apps run in isolated x86_64 Firecracker microVMs; sizes are the priced VM sizes.

## You need

- A deployment id from a failed ample deploy
- An Ample account token with servers:read

## Exact tested configuration

- build npm run build --if-present
- install npm install
- runtime node
- sizes-1vcpu-1gb
- start npm run start
- template node-22

## Steps

1. **Read the failure code.** Exit 1 with build_failed means next build failed in the isolated builder; exit 2 means a required preflight action is blocking.

2. **Read the build log.** Type errors, missing modules and memory failures show at the end of the build log.

```
   $ ample logs <deployment_id> --kind build
   ```

3. **Read the runtime log.** A live app that does not answer usually failed to bind 0.0.0.0 on PORT; the runtime log shows it.

```
   $ ample logs <deployment_id> --kind runtime
   ```

4. **Fix and redeploy once.** Change the source, then run ample deploy again. Do not loop deploys to poll status.

## How it was checked

✓ build log contains the failing command output· manual → “ample logs <deployment_id> --kind build shows the failure line”

## Evidence

1. November 5, 2026 · canary run  
   An intentionally failing build was rejected synchronously with build_failed and the failure line was readable in the build log.

2. November 6, 2026 · canary run  
   Next.js 15 SSR app (next build, next start) deployed on node-22; the page and an API route served correctly.

## Tested examples

- **Intentional build failure canary.** A failing build command is rejected synchronously and its stderr line appears in the build log.

## What it doesn’t cover

- Verified on the node-22 template at s-1vcpu-1gb.
- A failed build is reported synchronously with the failing log line, the same for Next.js as for any Node app.
