Repository navigation
fix(deploy): leave out run_worker_first rules that a wider rule already covers - #763
Merged
cpojer merged 1 commit intoNov 9, 2026
Conversation
…dy covers
An `output: "static"` Pages build lists only the paths with server code
in `run_worker_first`, each widened to its static prefix before the
first parameter. When one server path sits under another one's
`/prefix/*` rule, both rules were written:
```
pages/blog/[slug].tsx -> /blog/*
pages/blog/tags/[tag].tsx -> /blog/tags/*
```
Cloudflare rejects that list ("'/blog/tags/*': rule '/blog/*' makes it
redundant"). `vp build` succeeded, but `vp preview` exited and
`wrangler deploy` refused the output. A dynamic API route next to the
starter's `routes/api/hello.ts` (`/api/*` and `/api/hello`) failed the
same way. This affected such apps since 1.6.0 (voidzero-dev#660).
The planner now leaves out every rule that a `/prefix/*` rule in the
list already matches, including server paths under the assets folder
rule that a build adds when it cannot list its hashed files. The wider
rule sends the same requests to the Worker, so routing does not change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
cpojer
self-requested a review
November 9, 2026 23:37
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Since #660 (1.6.0), an
output: "static"Pages build lists only the paths with server code inrun_worker_first, so prerendered pages and public files are served without starting the Worker. Each pattern is widened to its static prefix before the first parameter (/blog/:slug→/blog/*). When one server path sits under another one's/prefix/*rule, both rules are written. For example, with two dynamic pages under/blog/:vp buildsucceeds without a warning, but Cloudflare rejects the list.vp previewexits with a Miniflare error, andwrangler deployrefuses the built output with the same message:A dynamic API route next to the starter's
routes/api/hello.tsfails the same way (/api/*and/api/hello). Apps withoutoutput: "static", and static apps that use middleware, auth, live updates,routing.alwaysUseHttpsor edge rules, get a list that starts with/**and are not affected.Fix
The planner now leaves out every rule that a
/prefix/*rule in the list already matches. The wider rule sends the same requests to the Worker, so routing does not change./assets/*rule that a build adds when it cannot list its hashed files in_headers./proxystays next to/proxy/*, and/api-docsnext to/api/*: neither starts with the wider rule's/prefix/.Tests
packages/void/test/unit/asset-worker-bypass.test.ts: nested wildcards, exact paths and a catch-all under a wildcard, a path below a trailing-wildcard route, and a server path under the/assets/*rule each keep only the wider rule. Both new cases fail without this fix.packages/void/test/integration/native-asset-cache-policy.test.ts: theoutput: "static"case passes the planner's list to Miniflare, which checksrun_worker_firstwith the same code as wrangler. It now adds/items/tags/:tagand/api/:namenext to/items/:idand/api/hello, and checks that/items/tags/newand/api/someonereach the Worker. Without this fix, Miniflare rejects the list ('/api/hello': rule '/api/*' makes it redundant).Verification
vp test run: 788 files pass, 1 skipped (16,467 tests pass, 30 skipped).vp run check: 33/33 pass.playground/static-pageswithpages/posts/tags/[tag]next topages/posts/[slug], androutes/api/[name].tsnext toroutes/api/hello.ts:vp buildpasses without a warning and writes/api/*,/api/hello,/posts/*and/posts/tags/*torun_worker_first.vp previewexits with'/api/hello': rule '/api/*' makes it redundantand'/posts/tags/*': rule '/posts/*' makes it redundant, andwrangler deploy --dry-run(4.158.0) fails with the same errors./api/*and/posts/*.vp previewstarts:/posts/tags/newsrenders its page,/api/helloand/api/someoneanswer from their own handlers, and a POST to/plainstill answers 405 from the asset layer.wrangler deploy --dry-runpasses.void deployagainst Cloudflare.🤖 Generated with Claude Code