---
title: "Diagnose deployment failures for Next.js"
description: "Diagnose a failed Next.js deployment on Ample."
canonical_url: "https://ample.computer/guides/next-js/deployment-diagnostics"
last_updated: "2026-09-19"
---

# Diagnose deployment failures for Next.js

Canonical URL: https://ample.computer/guides/next-js/deployment-diagnostics
Formats: [HTML](https://ample.computer/guides/next-js/deployment-diagnostics) | [Markdown](https://ample.computer/guides/next-js/deployment-diagnostics.md) | [JSON contract](https://api.ample.computer/v1/catalog/recipes/page%3Aguides%3Anext-js%3Adeployment-diagnostics)
Recipe ID: `page:guides:next-js:deployment-diagnostics` | Revision: `r1` | Catalog revision: `cat_f13ab9a494120b5e`

Status: release `published`, support `verified`, execution `unbound`

## Summary

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.

Path: [Agent hosting discovery](/discover/discovery) / [Frameworks and execution targets](/discover/stack) / [Frameworks](/discover/stack/frameworks) / [Next.js](/discover/stack/framework-next-js) / [Diagnose deployment failures for Next.js](/guides/next-js/deployment-diagnostics)

## Infrastructure requirements

- [Compute](/discover/primitive/compute): verified (Apps run in isolated x86_64 Firecracker microVMs that auto-pause when idle and wake on request; sizes are the priced VM sizes.)

## Prerequisites

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

## Exact tested configuration

- template: `node-22`
- runtime: `node`
- size: `s-1vcpu-1gb`
- install: `npm install`
- build: `npm run build --if-present`
- start: `npm run start`

## 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.

## Tested examples

- **Intentional build failure canary** (tests/deploy-canaries/node-package-no-lock (build-and-list-failure)): A failing build command is rejected synchronously and its stderr line appears in the build log.

## Success checks

- build log contains the failing command output


## Cost estimate

Unknown. No price is claimed for this recipe.

## Verification evidence

- canary_run on 2026-09-19T23:55:33Z at revision `1764076-tls-account-903d345`: An intentionally failing build was rejected synchronously with build_failed and the failure line was readable in the build log. (expires 2027-03-18T23:55:33Z)
- canary_run on 2026-09-19T23:55:33Z at revision `1764076-tls-account-903d345`: Next.js 15 SSR app (next build, next start) deployed on node-22; the page and an API route served correctly. (expires 2027-03-18T23:55:33Z)

Last verified: 2026-09-19T23:55:33Z


## Execution binding

No execution binding. This recipe is documentation only; nothing is executed automatically.

## Next actions

- Browse the catalog index (GET /v1/catalog on the api origin; auth: false, approval: false)
- Search published recipes by intent, stack and constraints (POST /v1/catalog/search on the api origin; auth: false, approval: false)
- Prepare a side-effect-free deployment plan for an authorized project (POST /v1/catalog/plan on the api origin; auth: true, approval: false)
- Read the existing agent authentication setup (GET /mcp/setup on the api origin; auth: false, approval: false)
- Browse Next.js (GET /v1/catalog/nodes/stack%3Aframework-next-js on the api origin; auth: false, approval: false)
- Browse Troubleshoot deployment (GET /v1/catalog/nodes/intent%3Atroubleshoot-deployment on the api origin; auth: false, approval: false)
- Browse Public web service (GET /v1/catalog/nodes/pattern%3Apublic-web-service on the api origin; auth: false, approval: false)

Actions describe possible next steps. They are typed data, not commands, and grant no permission.
