Next.js versions
Check which Next.js versions and features run on Azion, and the known issues to plan for before you deploy a Next.js app.
Next.js support on Azion varies by Next.js version and by feature. Each table marks a feature 🟢 supported, 🟡 partially supported, or 🔴 not supported. To build and deploy a Next.js application with the Azion CLI, refer to Build with Next.js.
OpenNext
The @aziontech/opennextjs-azion adapter deploys Next.js apps to Functions with the Node.js “runtime” from Next.js.
Get started
How you start with the adapter depends on whether the Next.js app exists.
New apps
To create a Next.js app configured to run on Azion with @aziontech/opennextjs-azion, run:
Existing Next.js apps
To use @aziontech/opennextjs-azion with an existing Next.js app, refer to Get Started With OpenNext.
Supported Next.js versions
The adapter supports all minor and patch versions of Next.js 15, and the latest minor version of Next.js 14.
To report a bug or contribute code, use the opennextjs-azion issues.
Supported Next.js features
The adapter supports these Next.js features:
| Feature | Support | Comments |
|---|---|---|
| App Router | 🟢 | |
| Route Handlers | 🟢 | |
| Dynamic routes | 🟢 | |
| Static Site Generation (SSG) | 🟢 | |
| Server-Side Rendering (SSR) | 🟢 | |
| Middleware | 🟢 | |
| Node Middleware | 🟡 | Node middleware, introduced in Next.js 15.2, is not supported |
| Image Optimization | 🔴 | |
| Partial Prerendering (PPR) | 🟢 | |
| Pages Router | 🟢 | |
| Incremental Static Regeneration (ISR) | 🟢 | |
| Support for after | 🟢 | |
| Composable Caching | 🔴 | 'use cache' |
Starter projects
To create a Next.js app for Azion, start from one of these projects:
- Next.js + TypeScript + Tailwind Template: a template for Next.js apps on Functions.
- Node Playground (Next.js 13): an example that runs Next.js 13 in a Node.js environment on Azion.
Each repository shows how to configure a Next.js app to run on Azion, and each one can be the starting point of your own project.
Known issues
The adapter has two known issues: the TypeScript configuration and local development.
TypeScript configuration
Your tsconfig.json must include this setting:
Without this setting, the build or the application at runtime can fail.
The open-next.config.ts file also has a known issue with ESM. An older project, or a project that depends on a specific TypeScript version or a custom configuration, may need one of two changes:
- Reconfigure the project, for example with
moduleResolutionset tobundler. - Exclude
open-next.config.tsintsconfig.json.
To exclude the file, add this line to your tsconfig.json:
Whether the exclusion works depends on your project setup. In some cases, the build proceeds, but errors still occur, especially in a project that uses _app.mdx or other advanced configurations. This applies most to projects that were not tested with these setups. Issues can also occur in other environments.
Local development
Some applications use Node.js or Web Standard APIs that Azion’s local development environment does not fully support. The deployed Azion Runtime can still make these APIs available.
Next.js 14.x.y
For Next.js 14.x.y, these features are supported:
| Feature | Support | Comments |
|---|---|---|
| Static Pages | 🟢 | |
| SSG | 🟢 |
Azion Runtime
The Azion Runtime support for Next.js changes with the Next.js version.
Versions 12.2.x and 12.3.x
For Next.js 12.2.x and 12.3.x, the Azion Runtime supports these Pages Router features:
| Pages Router support | Support | Comments |
|---|---|---|
| Static Pages | 🟢 | |
| SSR | 🟢 | |
| SSG | 🟢 | |
| API Routes | 🟢 | |
| Dynamic Routes | 🟢 | |
| Middleware | 🟡 | Features: rewrite, redirect, continue to response, set request header, throw error, set response header, and set response cookie |
| Next configs | 🟡 | Features: rewrite before files, rewrite after files, rewrite fallback, redirects, and header definition |
| i18n routing | 🟢 |
Versions 13.0.x, 13.1.x, 13.2.x, 13.3.x, 13.4.x, and 13.5.x
For these Next.js 13 versions, the Azion Runtime supports the Pages Router and the App Router. Pages Router features:
| Pages Router support | Support | Comments |
|---|---|---|
| Static Pages | 🟢 | |
| SSR | 🟢 | |
| SSG | 🟢 | |
| API Routes | 🟢 | |
| Dynamic Routes | 🟢 | |
| Middleware | 🟡 | Features: rewrite, redirect, continue to response, set request header, throw error, return response, set response header, and set response cookie |
| Next configs | 🟡 | Features: rewrite before files, rewrite after files, rewrite fallback, redirects, and header definition |
| i18n routing | 🟢 | |
| Custom errors | 🟢 |
App Router features:
| App Router support | Support | Comments |
|---|---|---|
| App router | 🟢 | Basic structure, routing, and layouts |
| Server Components | 🟢 | |
| Route Handlers | 🟢 | |
| Dynamic Routes | 🟢 | |
| Middleware | 🟡 | Features: rewrite, redirect, continue to response, set request header, throw error, set response header, and set response cookie |
| Next configs | 🟡 | Features: rewrite before files, rewrite after files, rewrite fallback, redirects, and header definition |
| i18n routing | 🟢 | |
| Custom errors | 🟢 |
Node Runtime
The Node Runtime table covers Next.js 12.3.x.
Version 12.3.x
For Next.js 12.3.x, the Node Runtime supports these Pages Router features:
| Pages Router support | Support | Comments |
|---|---|---|
| Static Pages | 🟢 | |
| SSR | 🟢 | |
| SSG | 🟢 | |
| API Routes | 🟢 | |
| Dynamic Routes | 🟢 | |
| Next configs | 🟡 | Features: rewrite before files, rewrite after files, rewrite fallback, redirects, and header definition |
| i18n routing | 🟢 | |
| Custom errors | 🟢 |
About Next.js
Next.js is a React framework for building applications. It handles these application requirements:
- Routing
- Data fetching
- Integrations
With Incremental Static Regeneration (ISR), Next.js applies static generation page by page, without a rebuild of the entire application. The application keeps the benefits of static pages and can still scale.
In Next.js, a page is a React component inside a file with one of these extensions:
.js.jsx.ts.tsx
Every page has a route based on its file name. For example, the file pages/azion.js exports this React component:
The page is available at /azion:
Pre-rendering
Next.js generates the HTML of each page in advance, so client-side JavaScript does not have to. Pre-rendering can improve the performance and the Search Engine Optimization (SEO) of an application.
Pre-rendering forms
Next.js pre-renders a page in one of two forms:
- Static Generation: the HTML is generated at build time and reused on each request.
- Server-side Rendering: the HTML is generated on each request.
For more information, refer to the Next.js documentation.