@aziontech/opennextjs-azion
v1.2.0
Published
Azion builder for Next.js apps
Maintainers
Readme
OpenNext for Azion
Deploy Next.js apps to Azion!
OpenNext is an adapter that enables the deployment of Next.js applications to Azion's developer platform.
Get started
To get started with OpenNext for Azion, you need to have an existing Next.js project or create a new Next.js project.
Or see the playground-13 example for a simple Next.js application that uses the OpenNext for Azion package.
To build, run the following command:
pnpm add @aziontech/opennextjs-azionLocal development
- you can use the regular
nextCLI to start the Next.js dev server:
Local preview
Run the following commands to preview the production build of your application locally:
build the app and adapt it for Azion
npx opennextjs-azion build # or pnpm opennextjs-azion build # or yarn opennextjs-azion buildPreview the app in Azion
npx opennextjs-azion preview # or pnpm opennextjs-azion preview # or yarn opennextjs-azion preview
Deploy by CLI
To deploy to Azion, you need an Azion account and must use the Azion CLI. See the Azion CLI Documentation for more information on how to set up your account and use the CLI.
To deploy your application to Azion using the Azion CLI, follow these steps:
Link your project:
azion linkBuild your application:
azion build --preset opennextjsPreview your application:
azion dev --port 3000 --skip-framework-buildThis will start a local server to preview your application.
Deploy your application:
azion deploy --skip-build --local
Environment Variables
The following environment variables can be used to customize the behavior of OpenNext for Azion:
OPEN_NEXTJS_NO_INTERACTIVE_PROMPT
Controls whether interactive prompts are shown during the build process.
- Default:
undefined(prompts are shown) - Values:
"true": Automatically creates required configuration files without prompting- Any other value or unset: Shows interactive prompts (default behavior)
Usage in CI/CD environments:
# Automatically create config files without user interaction
OPEN_NEXTJS_NO_INTERACTIVE_PROMPT=true azion build --preset opennextjsOr add to your .env file:
OPEN_NEXTJS_NO_INTERACTIVE_PROMPT=trueThis is particularly useful for remote builds, CI/CD pipelines, and automated deployments where user interaction is not possible.
NEXT_PRIVATE_DEBUG_CACHE
Enables detailed cache debugging logs for troubleshooting cache-related issues.
- Default:
undefined(no debug logs) - Values:
"true": Enables detailed cache operation logs- Any other value or unset: Normal logging (default behavior)
Usage for debugging:
# Enable cache debugging
NEXT_PRIVATE_DEBUG_CACHE=true azion build --preset opennextjsOr add to your .env file:
NEXT_PRIVATE_DEBUG_CACHE=trueThis will show detailed information about cache operations, including cache keys, storage operations, and any cache-related errors.
Turbopack Support (Next.js 16+)
OpenNext for Azion supports both webpack and Turbopack builds. Next.js 16 uses Turbopack by default, and the adapter runs the build command of your project as is: it does not force a bundler.
To keep building with webpack, add the --webpack flag to the build script of your package.json:
{
"scripts": {
"build": "next build --webpack"
}
}Node.js Middleware (proxy.ts)
Next.js 16 replaces middleware.ts with proxy.ts, which always runs on the Node.js runtime. OpenNext for Azion bundles it into a self-contained middleware for both webpack and Turbopack builds.
This support is experimental: it re-bundles the middleware compiled by Next.js, which is an internal output that can change between Next.js versions. The build logs a warning when a Node.js middleware is detected.
