Skip to content

fix(deploy): keep SvelteKit job bundles out of uploaded assets - #737

Open
morinokami wants to merge 1 commit into
voidzero-dev:mainfrom
morinokami:fix/void-handlers-asset-exposure
Open

morinokami wants to merge 1 commit into
voidzero-dev:mainfrom
morinokami:fix/void-handlers-asset-exposure

Conversation

@morinokami

Copy link
Copy Markdown
Contributor

void deploy --platform cloudflare uploads a SvelteKit Worker's directory as its static assets, so it lists the files Void adds there in .assetsignore. The list names the cron and queue bundle __void_handlers.mjs, but in an ES module package, which is what sv create makes, Vite names it __void_handlers.js. The compiled job code is then uploaded with the static assets.

With the config this deploy writes (run_worker_first: true), SvelteKit's Worker answers /__void_handlers.js with a 404, because it serves only its own static files from ASSETS. The file is still stored with the deployment's assets, and would be served if the Worker no longer ran first.

Fix

.assetsignore lists both __void_handlers.js and __void_handlers.mjs, as it already does for __original.js and __original.mjs.

Tests

packages/void/test/unit/cloudflare-deploy.test.ts: prepares an ES module SvelteKit app with a cron job and checks that .assetsignore matches every file Void adds to the Worker directory, so only the app's own assets remain. The case fails without this fix.

Verification

  • vp test run: 781 files pass, 1 skipped (16,160 tests pass, 29 skipped).
  • vp run check: 33/33 pass.
  • By hand on a copy of the SvelteKit playground, whose heartbeat cron makes Void add __void_handlers.js: build, prepareCloudflareFrameworkArtifact, then prepareCfFrameworkBuildOutput. Without this fix, the upload's assets include __void_handlers.js; with it, they don't. Served by Miniflare with those assets, /__void_handlers.js answers 404 with run_worker_first: true either way. With run_worker_first: false, it answers 200 with the job code without this fix, and 404 with it.
  • Not run: void deploy against Cloudflare.

🤖 Generated with Claude Code

SvelteKit's Worker directory is also its asset directory, so a native
deploy lists the files Void adds there in `.assetsignore`. The list named
the cron and queue bundle `__void_handlers.mjs`, but in an ES module
package, which is what `sv create` makes, Vite names it
`__void_handlers.js`, so the compiled job code was uploaded with the
static assets. SvelteKit's Worker runs first and does not serve it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant