Repository navigation
fix(deploy): serve framework static files without starting the Worker - #804
Merged
cpojer merged 1 commit intoNov 12, 2026
Merged
Conversation
Direct Cloudflare deploys of SvelteKit, Nuxt, Analog, and Astro wrote `assets.run_worker_first: true`. Every request for a built file or a prerendered page started the Worker, and a `run_worker_first` set in `cloudflare.assets` was overwritten. These deploys now default to `["/__void", "/__void/*"]`, like each framework's own Cloudflare config and managed framework deploys. Paths without a file still reach the Worker through `not_found_handling: "none"`. A `run_worker_first` set in void.config.ts is used as is. It is read from void.config.ts because the generated config can still hold the `true` an earlier deploy recorded in void.lock.json. SvelteKit uploads its Worker directory as assets, so the test that checks its uploaded files now covers the ISR module too. Fixes voidzero-dev#794 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Closes #794
void deploy --platform cloudflarewritesassets.run_worker_first: truefor SvelteKit, Nuxt, Analog, and Astro. Every request starts the Worker, including fingerprinted build files (/_astro/*,/_app/immutable/*,/_nuxt/*) and prerendered pages, and each one counts as a Worker request. The framework Worker only passes those requests toASSETS. The write also replaces arun_worker_firstset incloudflare.assetsinvoid.config.ts, althoughdocs/reference/config.mdsays Void passescloudflarefields through.Each framework's own Cloudflare config, and managed framework deploys, leave
run_worker_firstunset, so Cloudflare serves files without starting the Worker.Fix
Without a
run_worker_firstinvoid.config.ts, framework deploys now write["/__void", "/__void/*"]:run_worker_firstset invoid.config.tsis written as is.truekeeps the previous routing.void.config.ts, not from the generated config.void.lock.jsoncan hold thetruean earlier deploy wrote, and the generated config is restored from it.writeCloudflareFrameworkDeployConfigin@void/deploy-cloudflaretakes an optionalrunWorkerFirst. It still defaults totrue.docs/guide/edge/static-assets.mddescribes the default and the setting.Running the Worker first gave these files nothing extra:
/__void/*and HTML document ISR.ASSETSbefore rendering, so hooks and middleware do not run for them: SvelteKit's adapter Worker, Astro's (matchStaticAsset), and Nitro'scloudflare-modulepreset (isPublicAssetURL). A missing file still reaches the Worker, which answers as before.SvelteKit's asset directory
SvelteKit uploads its Worker directory as its assets. With
true, its Worker answered only its own files, so a module Void left there was stored but not served (#737). Cloudflare now serves any uploaded file from that directory, so.assetsignoremust list every module Void adds. A comment at that list says so. The test that checks SvelteKit's uploaded files now enables ISR, so it covers__void_isr.mjsas well.Projects deployed with v0.20
v0.20 wrote
run_worker_first: trueinto the rootwrangler.jsonc, and the migration tovoid.config.tscopied it intocloudflare.assets. Those projects keeptrueuntil they remove that line.Tests
packages/deploy-cloudflare/test/unit/framework.test.ts: a givenrun_worker_first(a rule list, orfalse) replaces an earliertrue, and writing it again changes nothing.packages/void/test/unit/cloudflare-deploy.test.ts:void.lock.jsonkept an earliertruegets the default.["/api/*"],true, andfalseset invoid.config.tsare written as is.__void_isr.mjsmust stay out of the upload too.Without this fix, the default, lock,
["/api/*"], andfalsecases fail withrun_worker_first: true.Verification
vp run test(all 794 files): 793 pass, 1 skipped (16,695 tests pass, 30 skipped).vp run check: 33/33 pass./_astro/*immutable rule in_headers:true,/_astro/app.abc123.js,/,/about/,/smoke, and/__void/readyall start the Worker.Cache-Control, and body./smokerenders in the Worker, and/__void/readyanswers{"ready":true}.void deployagainst Cloudflare.🤖 Generated with Claude Code