Skip to content

# Cloudflare Workers Builds fails to deploy Next.js 16 app with "Could not find compiled Open Next config" #15160

Description

@ShrinidhiM13

What versions & operating system are you using?

What versions & operating system are you using?

  • Cloudflare Workers Builds
  • Wrangler: 4.122.0
  • Next.js: 16.3.0
  • Node.js: 24.18.0
  • npm: 10.9.2
  • OS: Cloudflare Workers Builds environment
  • Package manager: npm
  • Adapter: @opennextjs/cloudflare

The project uses the Next.js App Router.

Describe the Bug

The Next.js production build completes successfully in Cloudflare Workers Builds, but the deployment fails immediately afterward.

The configured build command is:

npm run build

which runs:

next build --webpack

The Next.js build completes successfully:

✓ Compiled successfully in 25.5s
✓ Finished TypeScript in 7.2s
✓ Generating static pages using 1 worker (42/42) in 2.2s
Success: Build command completed

However, the deployment command is:

npx wrangler deploy

Wrangler detects the project as an OpenNext project and automatically invokes:

OpenNext project detected, calling `opennextjs-cloudflare deploy`

The deployment then fails with:

ERROR Could not find compiled Open Next config, did you run the build command?

The important part is that the normal Next.js build succeeds, but the OpenNext build has not been executed.

Cloudflare Build/Deploy Configuration

Build command:

npm run build

Deploy command:

npx wrangler deploy

Current package.json scripts include:

{
  "scripts": {
    "build": "next build --webpack"
  }
}

The project has @opennextjs/cloudflare installed.

Relevant Logs

2026-08-13T00:50:20.563Z
> arkatva-web@0.1.0 build
> next build --webpack

▲ Next.js 16.3.0 (webpack)

✓ Compiled successfully in 25.5s
Running TypeScript ...
Finished TypeScript in 7.2s ...
Collecting page data using 1 worker ...
Generating static pages using 1 worker (42/42) in 2.2s
Finalizing page optimization ...
Collecting build traces ...

Success: Build command completed

Executing user deploy command: npx wrangler deploy

⛅️ wrangler 4.122.0

OpenNext project detected, calling `opennextjs-cloudflare deploy`

┌──────────────────────────────┐
│ OpenNext — Cloudflare deploy │
└──────────────────────────────┘

ERROR Could not find compiled Open Next config, did you run the build command?

Failed: error occurred while running deploy command

Expected Behavior

The Workers Build pipeline should either:

  1. Automatically run the OpenNext compilation step before calling the OpenNext deploy command, or
  2. Clearly indicate that the configured build command must be:
opennextjs-cloudflare build

rather than only:

next build

when the project is detected as an OpenNext project.

Ideally, automatic Next.js/OpenNext detection should ensure that the build output required by the subsequent opennextjs-cloudflare deploy command exists.

Actual Behavior

The build step successfully produces the normal Next.js .next output, but the subsequent OpenNext deployment expects compiled OpenNext output under .open-next.

Because the OpenNext build step was not executed, deployment fails with:

Could not find compiled Open Next config, did you run the build command?

Possible Workaround

Changing the Workers Builds build command to:

npx opennextjs-cloudflare build

or configuring the package scripts so that the build step generates the OpenNext output before deployment appears to resolve the mismatch.

For example:

{
  "scripts": {
    "build": "next build --webpack",
    "build:worker": "opennextjs-cloudflare build",
    "deploy": "npm run build:worker && opennextjs-cloudflare deploy"
  }
}

However, it is unclear whether Workers Builds is expected to handle this automatically when it detects an OpenNext project.

Minimal Reproduction

Repository:

<INSERT_GITHUB_REPOSITORY_URL_HERE>

The project can be reproduced using:

npm install
npm run build
npx wrangler deploy

Additional Information

The application contains 42 statically generated routes and the Next.js build completes without TypeScript or compilation errors.

The failure occurs exclusively during the OpenNext deployment stage after the successful Next.js build.

This appears to be related to the distinction between:

next build

and:

opennextjs-cloudflare build

when using Cloudflare Workers Builds with the OpenNext adapter.

Please provide a link to a minimal reproduction

https://github.com/ShrinidhiM13/opennext-cloudflare-repro

Describe the Bug

What versions & operating system are you using?

  • Cloudflare Workers Builds
  • Wrangler: 4.122.0
  • Next.js: 16.3.0
  • Node.js: 24.18.0
  • npm: 10.9.2
  • OS: Cloudflare Workers Builds environment
  • Package manager: npm
  • Adapter: @opennextjs/cloudflare

The project uses the Next.js App Router.

Describe the Bug

The Next.js production build completes successfully in Cloudflare Workers Builds, but the deployment fails immediately afterward.

The configured build command is:

npm run build

which runs:

next build --webpack

The Next.js build completes successfully:

✓ Compiled successfully in 25.5s
✓ Finished TypeScript in 7.2s
✓ Generating static pages using 1 worker (42/42) in 2.2s
Success: Build command completed

However, the deployment command is:

npx wrangler deploy

Wrangler detects the project as an OpenNext project and automatically invokes:

OpenNext project detected, calling `opennextjs-cloudflare deploy`

The deployment then fails with:

ERROR Could not find compiled Open Next config, did you run the build command?

The important part is that the normal Next.js build succeeds, but the OpenNext build has not been executed.

Cloudflare Build/Deploy Configuration

Build command:

npm run build

Deploy command:

npx wrangler deploy

Current package.json scripts include:

{
  "scripts": {
    "build": "next build --webpack"
  }
}

The project has @opennextjs/cloudflare installed.

Relevant Logs

2026-08-13T00:50:20.563Z
> arkatva-web@0.1.0 build
> next build --webpack

▲ Next.js 16.3.0 (webpack)

✓ Compiled successfully in 25.5s
Running TypeScript ...
Finished TypeScript in 7.2s ...
Collecting page data using 1 worker ...
Generating static pages using 1 worker (42/42) in 2.2s
Finalizing page optimization ...
Collecting build traces ...

Success: Build command completed

Executing user deploy command: npx wrangler deploy

⛅️ wrangler 4.122.0

OpenNext project detected, calling `opennextjs-cloudflare deploy`

┌──────────────────────────────┐
│ OpenNext — Cloudflare deploy │
└──────────────────────────────┘

ERROR Could not find compiled Open Next config, did you run the build command?

Failed: error occurred while running deploy command

Expected Behavior

The Workers Build pipeline should either:

  1. Automatically run the OpenNext compilation step before calling the OpenNext deploy command, or
  2. Clearly indicate that the configured build command must be:
opennextjs-cloudflare build

rather than only:

next build

when the project is detected as an OpenNext project.

Ideally, automatic Next.js/OpenNext detection should ensure that the build output required by the subsequent opennextjs-cloudflare deploy command exists.

Actual Behavior

The build step successfully produces the normal Next.js .next output, but the subsequent OpenNext deployment expects compiled OpenNext output under .open-next.

Because the OpenNext build step was not executed, deployment fails with:

Could not find compiled Open Next config, did you run the build command?

Possible Workaround

Changing the Workers Builds build command to:

npx opennextjs-cloudflare build

or configuring the package scripts so that the build step generates the OpenNext output before deployment appears to resolve the mismatch.

For example:

{
  "scripts": {
    "build": "next build --webpack",
    "build:worker": "opennextjs-cloudflare build",
    "deploy": "npm run build:worker && opennextjs-cloudflare deploy"
  }
}

However, it is unclear whether Workers Builds is expected to handle this automatically when it detects an OpenNext project.

Minimal Reproduction

Repository:

<INSERT_GITHUB_REPOSITORY_URL_HERE>

The project can be reproduced using:

npm install
npm run build
npx wrangler deploy

Additional Information

The application contains 42 statically generated routes and the Next.js build completes without TypeScript or compilation errors.

The failure occurs exclusively during the OpenNext deployment stage after the successful Next.js build.

This appears to be related to the distinction between:

next build

and:

opennextjs-cloudflare build

when using Cloudflare Workers Builds with the OpenNext adapter.

Please provide any relevant error logs

2026-08-13T00:57:52.505Z Initializing build environment...
2026-08-13T00:58:23.511Z Success: Finished initializing build environment
2026-08-13T00:58:24.323Z Cloning repository...
2026-08-13T00:58:26.621Z Detected the following tools from environment: npm@10.9.2, nodejs@24.18.0
2026-08-13T00:58:26.623Z Restoring from dependencies cache
2026-08-13T00:58:26.627Z Restoring from build output cache
2026-08-13T00:58:26.754Z Installing project dependencies: npm clean-install --progress=false
2026-08-13T00:58:39.580Z npm warn deprecated node-domexception@1.0.0: Use your platform's native DOMException instead
2026-08-13T00:58:42.831Z npm warn deprecated glob@9.3.5: Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me
2026-08-13T00:59:06.033Z
2026-08-13T00:59:06.033Z added 666 packages, and audited 667 packages in 38s
2026-08-13T00:59:06.034Z
2026-08-13T00:59:06.034Z 205 packages are looking for funding
2026-08-13T00:59:06.034Z run npm fund for details
2026-08-13T00:59:06.036Z
2026-08-13T00:59:06.036Z found 0 vulnerabilities
2026-08-13T00:59:06.036Z npm warn allow-scripts 4 packages have install scripts not yet covered by allowScripts:
2026-08-13T00:59:06.036Z npm warn allow-scripts esbuild@0.25.4 (postinstall: node install.js)
2026-08-13T00:59:06.036Z npm warn allow-scripts unrs-resolver@1.12.2 (postinstall: node postinstall.js)
2026-08-13T00:59:06.036Z npm warn allow-scripts workerd@1.20260811.1 (postinstall: node install.js)
2026-08-13T00:59:06.037Z npm warn allow-scripts esbuild@0.28.1 (postinstall: node install.js)
2026-08-13T00:59:06.037Z npm warn allow-scripts
2026-08-13T00:59:06.037Z npm warn allow-scripts Run npm approve-scripts --allow-scripts-pending to review, or npm approve-scripts <pkg> to allow.
2026-08-13T00:59:06.292Z Executing user build command: npm run build
2026-08-13T00:59:06.581Z
2026-08-13T00:59:06.581Z > arkatva-web@0.1.0 build
2026-08-13T00:59:06.583Z > next build --webpack
2026-08-13T00:59:06.584Z
2026-08-13T00:59:07.129Z ▲ Next.js 16.3.0 (webpack)
2026-08-13T00:59:07.187Z ✓ Running next.config.ts took 63ms
2026-08-13T00:59:07.187Z ⚠ No build cache found. Please configure build caching for faster rebuilds. Read more: https://nextjs.org/docs/messages/no-cache
2026-08-13T00:59:07.193Z Attention: Next.js now collects completely anonymous telemetry regarding usage.
2026-08-13T00:59:07.194Z This information is used to shape Next.js' roadmap and prioritize features.
2026-08-13T00:59:07.194Z You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
2026-08-13T00:59:07.195Z https://nextjs.org/telemetry
2026-08-13T00:59:07.195Z
2026-08-13T00:59:07.216Z
2026-08-13T00:59:07.267Z Creating an optimized production build ...
2026-08-13T00:59:28.698Z ✓ Compiled successfully in 18.1s
2026-08-13T00:59:28.703Z Running TypeScript ...
2026-08-13T00:59:35.087Z Finished TypeScript in 6.4s ...
2026-08-13T00:59:35.090Z Collecting page data using 1 worker ...
2026-08-13T00:59:37.078Z Generating static pages using 1 worker (0/42) ...
2026-08-13T00:59:38.493Z Generating static pages using 1 worker (10/42)
2026-08-13T00:59:38.784Z Generating static pages using 1 worker (20/42)
2026-08-13T00:59:39.093Z Generating static pages using 1 worker (31/42)
2026-08-13T00:59:39.272Z ✓ Generating static pages using 1 worker (42/42) in 2.2s
2026-08-13T00:59:40.023Z Finalizing page optimization ...
2026-08-13T00:59:40.025Z Collecting build traces ...
2026-08-13T01:00:07.012Z
2026-08-13T01:00:07.016Z Route (app)
2026-08-13T01:00:07.016Z ┌ ○ /
2026-08-13T01:00:07.016Z ├ ○ /_not-found
2026-08-13T01:00:07.017Z ├ ○ /about
2026-08-13T01:00:07.017Z ├ ○ /blog
2026-08-13T01:00:07.017Z ├ ƒ /blog/[slug]
2026-08-13T01:00:07.017Z ├ ○ /contact
2026-08-13T01:00:07.017Z ├ ○ /customer-success
2026-08-13T01:00:07.017Z ├ ○ /pricing
2026-08-13T01:00:07.018Z ├ ○ /products
2026-08-13T01:00:07.018Z ├ /products/[slug]
2026-08-13T01:00:07.018Z │ ├ ● /products/flow
2026-08-13T01:00:07.018Z │ ├ ● /products/desk
2026-08-13T01:00:07.018Z │ ├ ● /products/insight
2026-08-13T01:00:07.018Z │ └ ● [+5 more paths]
2026-08-13T01:00:07.018Z ├ ○ /resources/blog
2026-08-13T01:00:07.018Z ├ ƒ /resources/blog/[slug]
2026-08-13T01:00:07.019Z ├ ○ /robots.txt
2026-08-13T01:00:07.019Z ├ ○ /services
2026-08-13T01:00:07.019Z ├ /services/[slug]
2026-08-13T01:00:07.019Z │ ├ ● /services/software-development
2026-08-13T01:00:07.019Z │ ├ ● /services/saas-development
2026-08-13T01:00:07.019Z │ ├ ● /services/cloud-solutions
2026-08-13T01:00:07.019Z │ └ ● [+3 more paths]
2026-08-13T01:00:07.019Z ├ ○ /sitemap.xml
2026-08-13T01:00:07.019Z ├ ○ /solutions
2026-08-13T01:00:07.019Z ├ /solutions/[slug]
2026-08-13T01:00:07.019Z │ ├ ● /solutions/healthcare
2026-08-13T01:00:07.020Z │ ├ ● /solutions/education
2026-08-13T01:00:07.020Z │ ├ ● /solutions/retail
2026-08-13T01:00:07.020Z │ └ ● [+8 more paths]
2026-08-13T01:00:07.020Z ├ ○ /technologies
2026-08-13T01:00:07.021Z └ ○ /work
2026-08-13T01:00:07.021Z
2026-08-13T01:00:07.021Z
2026-08-13T01:00:07.023Z ○ (Static) prerendered as static content
2026-08-13T01:00:07.023Z ● (SSG) prerendered as static HTML (uses generateStaticParams)
2026-08-13T01:00:07.023Z ƒ (Dynamic) server-rendered on demand
2026-08-13T01:00:07.023Z
2026-08-13T01:00:07.115Z Success: Build command completed
2026-08-13T01:00:07.298Z Executing user deploy command: npx wrangler deploy
2026-08-13T01:00:09.529Z
2026-08-13T01:00:09.531Z ⛅️ wrangler 4.122.0
2026-08-13T01:00:09.531Z ────────────────────
2026-08-13T01:00:09.582Z OpenNext project detected, calling opennextjs-cloudflare deploy
2026-08-13T01:00:15.225Z
2026-08-13T01:00:15.225Z ┌──────────────────────────────┐
2026-08-13T01:00:15.227Z │ OpenNext — Cloudflare deploy │
2026-08-13T01:00:15.227Z └──────────────────────────────┘
2026-08-13T01:00:15.227Z
2026-08-13T01:00:15.227Z ERROR Could not find compiled Open Next config, did you run the build command?
2026-08-13T01:00:15.298Z
2026-08-13T01:00:15.298Z Cloudflare collects anonymous telemetry about your usage of Wrangler. Learn more at https://github.com/cloudflare/workers-sdk/tree/main/packages/wrangler/telemetry.md
2026-08-13T01:00:15.298Z
2026-08-13T01:00:15.389Z ✘ [ERROR]
2026-08-13T01:00:15.389Z
2026-08-13T01:00:15.389Z
2026-08-13T01:00:15.392Z If you think this is a bug then please create an issue at https://github.com/cloudflare/workers-sdk/issues/new/choose
2026-08-13T01:00:15.410Z 🪵 Logs were written to "/opt/buildhome/.config/.wrangler/logs/wrangler-2026-08-13_01-00-08_989.log"
2026-08-13T01:00:15.509Z Failed: error occurred while running deploy command

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    Status
    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions