Repository navigation
fix(deploy): keep SvelteKit job bundles out of uploaded assets - #737
Open
morinokami wants to merge 1 commit into
Open
morinokami wants to merge 1 commit into
morinokami wants to merge 1 commit into
Conversation
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
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.
void deploy --platform cloudflareuploads 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 whatsv createmakes, 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.jswith a 404, because it serves only its own static files fromASSETS. The file is still stored with the deployment's assets, and would be served if the Worker no longer ran first.Fix
.assetsignorelists both__void_handlers.jsand__void_handlers.mjs, as it already does for__original.jsand__original.mjs.Tests
packages/void/test/unit/cloudflare-deploy.test.ts: prepares an ES module SvelteKit app with a cron job and checks that.assetsignorematches 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.heartbeatcron makes Void add__void_handlers.js: build,prepareCloudflareFrameworkArtifact, thenprepareCfFrameworkBuildOutput. Without this fix, the upload's assets include__void_handlers.js; with it, they don't. Served by Miniflare with those assets,/__void_handlers.jsanswers 404 withrun_worker_first: trueeither way. Withrun_worker_first: false, it answers 200 with the job code without this fix, and 404 with it.void deployagainst Cloudflare.🤖 Generated with Claude Code