Skip to content

[wrangler] Configure Next.js projects with vinext - #15020

Open
scottbuscemi wants to merge 1 commit into
cloudflare:mainfrom
scottbuscemi:next-vinext-autoconfig
Open

[wrangler] Configure Next.js projects with vinext#15020
scottbuscemi wants to merge 1 commit into
cloudflare:mainfrom
scottbuscemi:next-vinext-autoconfig

Conversation

@scottbuscemi

@scottbuscemi scottbuscemi commented Aug 4, 2026

Copy link
Copy Markdown

Related to #14896.

Configure and deploy Next.js 16 projects with vinext instead of OpenNext through Wrangler automatic configuration. The setup uses explicit non-interactive Cloudflare defaults, delegates deployment to vinext-cloudflare, and preserves support for existing or manually configured OpenNext projects.


A picture of a cute animal (not mandatory, but encouraged)
Beautiful-red-cat-stretches-and-shows-tongue


Open in Devin Review

@changeset-bot

changeset-bot Bot commented Aug 4, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 3c76945

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
@cloudflare/autoconfig Minor
wrangler Minor
@cloudflare/vite-plugin Patch
@cloudflare/vitest-pool-workers Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-project-automation github-project-automation Bot moved this to Untriaged in workers-sdk Aug 4, 2026
@workers-devprod
workers-devprod requested review from a team and NuroDev and removed request for a team August 4, 2026 16:32
@workers-devprod

Copy link
Copy Markdown
Contributor

Codeowners approval required for this PR:

  • @cloudflare/wrangler
Show detailed file reviewers
  • .changeset/next-vinext-autoconfig.md: [@cloudflare/wrangler]
  • packages/autoconfig/src/frameworks/all-frameworks.ts: [@cloudflare/wrangler]
  • packages/autoconfig/src/frameworks/next.ts: [@cloudflare/wrangler]
  • packages/autoconfig/tests/frameworks/next.test.ts: [@cloudflare/wrangler]
  • packages/wrangler/src/tests/deploy/vinext.test.ts: [@cloudflare/wrangler]
  • packages/wrangler/src/deploy/autoconfig.ts: [@cloudflare/wrangler]
  • packages/wrangler/src/deploy/index.ts: [@cloudflare/wrangler]
  • packages/wrangler/src/deploy/open-next.ts: [@cloudflare/wrangler]
  • packages/wrangler/src/deploy/vinext.ts: [@cloudflare/wrangler]

@pkg-pr-new

pkg-pr-new Bot commented Aug 4, 2026

Copy link
Copy Markdown
@cloudflare/autoconfig

npm i https://pkg.pr.new/@cloudflare/autoconfig@15020

@cloudflare/build-output-utils

npm i https://pkg.pr.new/@cloudflare/build-output-utils@15020

@cloudflare/config

npm i https://pkg.pr.new/@cloudflare/config@15020

create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@15020

@cloudflare/deploy-helpers

npm i https://pkg.pr.new/@cloudflare/deploy-helpers@15020

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@15020

miniflare

npm i https://pkg.pr.new/miniflare@15020

@cloudflare/pages-functions

npm i https://pkg.pr.new/@cloudflare/pages-functions@15020

@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@15020

@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@15020

@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@15020

@cloudflare/vitest-pool-workers

npm i https://pkg.pr.new/@cloudflare/vitest-pool-workers@15020

@cloudflare/workers-auth

npm i https://pkg.pr.new/@cloudflare/workers-auth@15020

@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/@cloudflare/workers-editor-shared@15020

@cloudflare/workers-utils

npm i https://pkg.pr.new/@cloudflare/workers-utils@15020

wrangler

npm i https://pkg.pr.new/wrangler@15020

commit: 3c76945

@devin-ai-integration devin-ai-integration Bot left a comment

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.

Devin Review found 1 potential issue.

View 2 additional findings in Devin Review.

Open in Devin Review

Comment on lines +80 to +84
throw new UserError(
`The Wrangler option ${JSON.stringify(argument)} cannot be forwarded to vinext. Add the equivalent setting to wrangler.jsonc, then run \`wrangler deploy\` again.`,
{ telemetryMessage: "vinext deploy option unsupported" }
);
}

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.

🟡 Deploying with any extra command-line option fails outright in Next.js projects set up with the new tooling

Any deploy option other than the worker name or environment is rejected outright (UserError at packages/wrangler/src/deploy/vinext.ts:80-83) instead of being handled, so a normal deploy command with common extra options — or one that explicitly points at a script or assets folder — stops with an error and nothing is deployed.
Impact: Users of these projects can no longer deploy when they pass everyday options such as a script path, an assets directory, or a log level; the deploy aborts with a confusing message.

Delegation path ignores the explicit-target escape hatches that autoconfig respects

packages/wrangler/src/deploy/index.ts:171-181 gates the new delegation only on !pagesToWorkersDelegation && args.autoconfig && !args.config && !args.dryRun. Unlike the autoconfig gate at packages/wrangler/src/deploy/autoconfig.ts:81-89, it does not exclude args.path, args.script or args.assets. So in a directory detected as a vinext project (isVinextProject, packages/wrangler/src/deploy/vinext.ts:89-131), running e.g. wrangler deploy ./some-worker/index.ts, wrangler deploy --assets ./public, or wrangler deploy --log-level debug reaches getVinextDeployArguments, which only tolerates --autoconfig, --name and --env/-e, and throws a UserError for everything else (including the positional path). The previous OpenNext delegation simply forwarded all arguments (packages/wrangler/src/deploy/open-next.ts:26-40), so this is a new hard failure mode.

Prompt for agents
In packages/wrangler/src/deploy/vinext.ts, getVinextDeployArguments() throws a UserError for every argument other than --autoconfig, --name and --env/-e. The delegation call site in packages/wrangler/src/deploy/index.ts only checks !pagesToWorkersDelegation, args.autoconfig, !args.config and !args.dryRun, so it also triggers when the user explicitly targets something else (positional script path, --script, --assets) or passes harmless global flags such as --log-level. In those cases the deploy aborts entirely instead of proceeding, which is a regression relative to the OpenNext delegation which forwarded all arguments. Consider (a) skipping delegation when args.path/args.script/args.assets are set, mirroring the autoconfig gate in packages/wrangler/src/deploy/autoconfig.ts, and (b) either ignoring/forwarding benign global flags (e.g. --log-level, --autoconfig=false) or deciding whether to delegate before parsing so unsupported flags fall back to the normal wrangler deploy path rather than failing.
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

@emily-shen emily-shen left a comment

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.

hey just blocking as we are discussing internally how we can do this change without breaking people running autoconfig each time in CI

@github-project-automation github-project-automation Bot moved this from Untriaged to In Review in workers-sdk Aug 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Review

Development

Successfully merging this pull request may close these issues.

3 participants