@aziontech/opennextjs-azion
v1.1.2
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 currently does not support Turbopack. We automatically force the use of webpack by adding the --webpack flag to the next build command during the build process.
What is Turbopack?
Turbopack offers faster build times, OpenNext for Azion requires webpack-specific optimizations and transformations that are not yet compatible with Turbopack's architecture.
Automatic Webpack Enforcement
When you run npx opennextjs-azion build, we automatically:
- Add the
--webpackflag to thenext buildcommand - Ensure your application is built using webpack instead of Turbopack
- Apply all necessary transformations for Azion deployment
Troubleshooting Turbopack-related Issues
If you encounter errors like:
✘ [ERROR] ⨯ Error: Failed to load chunk server/chunks/ssr/<chunk_name>.jsThis typically indicates that Turbopack was used during the build process. OpenNext for Azion handles this automatically, but if you're manually running next build commands, make sure to use:
# ✅ Correct - uses webpack
next build
# ❌ Incorrect - uses Turbopack (not supported)
next build --turbo