Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions content/(publish)/frameworks.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,9 @@ Same routing conventions as the Astro integration, plus a check that the build i

### `@spacefast/next-adapter`

Wired for you. When `sf publish` runs `next build` on Next 16.2 or 16.3, it points Next at the bundled adapter through `NEXT_ADAPTER_PATH`, so there is nothing to add to `next.config`. The adapter opts the build into immutable static assets and writes down what Next produced for the classifier to read.
Wired for you. When `sf publish` runs `next build` on Next 16.4.5 and later 16.4 releases, it points Next at the bundled adapter through `NEXT_ADAPTER_PATH`, so there is nothing to add to `next.config`. The adapter opts the build into immutable static assets and writes down what Next produced for the classifier to read.

The adapter runs on Next 16.2 and 16.3, the releases with the `experimental.adapterPath` hook it needs. Server-rendered builds also work on Next 15.5.24 and later 15.5 releases without the adapter. Other releases from 14.2 through 16.4 build only with `output: "export"`. See the [Next.js recipe](/recipes/next) for the full table.
Server-rendered builds also work on Next 15.5.29 and later 15.5 releases without the adapter. Older releases have known security vulnerabilities, so Spacefast refuses to build them. See the [Next.js recipe](/recipes/next) for the full table.

## Next steps

Expand Down
7 changes: 3 additions & 4 deletions content/(publish)/migrate-from/vercel.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,10 @@ A Spacefast cron is a scheduled `GET` against a path on your own Space, like a V

| Next.js | What runs |
| --- | --- |
| 16.2.x, 16.3.x | Server-rendered builds, through the adapter `sf publish` wires in for you |
| 15.5.24 and later 15.5 releases | Server-rendered builds |
| 14.2, 15.0 to 15.5.23, 16.0, 16.1, 16.4 | `output: "export"` only |
| 16.4.5 and later 16.4 releases | Server-rendered builds, through the adapter `sf publish` wires in for you |
| 15.5.29 and later 15.5 releases | Server-rendered builds |

Other versions are refused before anything builds. The [Next.js recipe](/recipes/next) has the details and the export fallback.
Older releases have known security vulnerabilities, so they are refused before anything builds, with the version to upgrade to. The [Next.js recipe](/recipes/next) has the details and the export fallback.

## What doesn't

Expand Down
19 changes: 9 additions & 10 deletions content/(publish)/recipes/next.mdx
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
---
title: Next.js
description: Build a Next.js app with the bundled Spacefast adapter, or publish a static export from an older Next
description: Build a Next.js app with the bundled Spacefast adapter on a supported, patched Next release
---

Next.js is detected by its `next` dependency. A project that also depends on `nextra` matches the Nextra row instead, which builds and outputs the same way.

## What to build

The default `next build`. On Next 16.2 and 16.3, the CLI first points Next at the bundled `@spacefast/next-adapter` through the `NEXT_ADAPTER_PATH` environment variable, so there is nothing to add to `next.config`. The adapter opts the build into immutable static assets and writes down what Next produced for the classifier to read.
The default `next build`. On Next 16.4.5 and later 16.4 releases, the CLI first points Next at the bundled `@spacefast/next-adapter` through the `NEXT_ADAPTER_PATH` environment variable, so there is nothing to add to `next.config`. The adapter opts the build into immutable static assets and writes down what Next produced for the classifier to read.

## Supported Next versions

| Next.js | Server-rendered build | `output: "export"` |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Bug · Documented version policy doesn't match the CLI in monorepo#5738

This table drops 16.2.x, 16.3.x and raises the 15.5 floor to 29, but spacefast/monorepo#5738 (open, head a9ff9279) still has the 16.2/16.3 adapter profiles in packages/cli/src/next-build-compatibility.ts, LEGACY_SERVER_RANGE = ">=15.5.24 <16.0.0", and accepts 14.2, 15.0 to 15.5.x and 16.0 to 16.4.4 as automatic static exports. Its refusal message says nothing about security advisories or an upgrade version. The same claims are in frameworks.mdx and migrate-from/vercel.mdx. Align the CLI or the docs before merging.

Found by Indent Review Agent

| --- | --- | --- |
| 16.2.x, 16.3.x | Yes, through the bundled adapter | Yes |
| 15.5.24 and later 15.5 releases | Yes | Yes |
| 14.2, 15.0 to 15.5.23, 16.0, 16.1, 16.4 | No | Yes |
| 16.4.5 and later 16.4 releases | Yes, through the bundled adapter | Yes |
| 15.5.29 and later 15.5 releases | Yes | Yes |

Only stable releases count; canary and other prerelease versions are refused.
Spacefast builds the same releases its server bundler, OpenNext, supports. Its minimum versions follow Next.js security releases, so every older release has published [security advisories](https://github.com/vercel/next.js/security/advisories), and Spacefast refuses to build it. Only stable releases count; canary and other prerelease versions are refused.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚪️ Nit · "Same releases OpenNext supports" doesn't describe the 15.5 row

In #5738 only the 16.4 profile uses OpenNext 1.20.17. The 15.5 legacy-server path still pins openNextVersion: "1.20.6" with its own floor, so "the same releases OpenNext supports" doesn't describe the 15.5 row. State the minimums directly.

Found by Indent Review Agent


## The output directory

Expand All @@ -42,15 +41,15 @@ Published: https://quiet-harbor.space.fast

## The gotcha

Both refusals fail with this code:
A version outside the table fails with this code, before anything builds, and exits with code 2:

```text
next_version_unsupported
```

A version outside the table stops before anything builds. A server-rendered config on an export-only version runs `next build` first, then stops once the CLI sees the output is not an export. Both exit with code 2. There is no guessing fallback, because a publish classified from guessed facts is worse than a refused one.
For an older release, the error says it has known security vulnerabilities and names the version to upgrade to. Upgrade, then publish again. There is no guessing fallback, because a publish classified from guessed facts is worse than a refused one.

On an export-only version, set `output: "export"` and let `sf publish` build it. On an unsupported version, do the export yourself and upload it:
If you can't upgrade yet, build a static export yourself and upload it:

```js next.config.js
module.exports = { output: "export" };
Expand All @@ -61,4 +60,4 @@ npx next build
sf publish ./out --prebuilt
```

One related failure mode on Next 16.2 and 16.3. If a custom build command runs `next build` in a way that loses the environment the CLI set, the adapter never runs. The publish then stops with `build_failed`, saying `.spacefast/next-build.json` was not written. Let the CLI invoke the build, or pass its environment through your wrapper.
One related failure mode on Next 16.4. If a custom build command runs `next build` in a way that loses the environment the CLI set, the adapter never runs. The publish then stops with `build_failed`, saying `.spacefast/next-build.json` was not written. Let the CLI invoke the build, or pass its environment through your wrapper.
Loading