Repository navigation
fix(deploy): read server values from void/env in cron and queue jobs - #724
Merged
cpojer merged 1 commit intoNov 5, 2026
Merged
Conversation
The deploy wrapper's cron and queue bundle is a library build, which defaults to browser conditions. `void/env` resolved to its client variant there, so a deployed job that read a server key threw "is not exposed to the client". The same job worked in `vp dev`, and `/__void/ready` still returned 200, so the failure only showed up after a deploy. The bundle now uses Worker conditions, as `bundleEntry` does. Dependencies with `workerd` or `worker` exports also get their Worker builds in jobs. 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.
In a framework app deployed with
void deploy, a cron job or queue consumer that reads a server value fromvoid/envfails:The same job works in
vp dev, and/__void/readyreturns 200, so the failure only shows up when the job runs after a deploy. Theenvargument that a handler receives is not affected.generateWrappercompiles these jobs in a library build, which defaults to browser conditions, sovoid/envresolves to its client variant.Fix
The build now uses Worker conditions plus
production, asbundleEntryandprepareBundledBuildOutputdo.workerdorworkerexports now get their Worker builds in jobs too, as they do in the app's own bundle. Among Void's own subpaths, onlyvoid/envhas conditional exports like this.void/envimportsnode:async_hooks. By default, framework deploys give the Workernodejs_alsornodejs_compat, so it loads.Tests
packages/void/test/unit/wrapper.test.ts: D1 and PostgreSQL apps whose cron and queue jobs read a server value fromvoid/env, run in workerd. The D1 case runs with onlynodejs_als, as SvelteKit, Nuxt and Astro deploys do. The PostgreSQL case runs the jobs in a request scope. Both cases fail without this fix.Verification
vp test run: 776 files pass, 1 skipped (16,003 tests pass, 29 skipped).vp run check: 33/33 pass.generateWrapper, then that framework's upload preparation, run in Miniflare under the flags a D1 deploy gives it./__void/readyanswers 200. A cron job and a queue consumer readSTRIPE_KEYfromvoid/env, and the cron job also reads a default through an importedenv.ts.vp devon a copy of the React Router playground: a cron job reads its value fromvoid/env.void deployagainst Cloudflare. The SvelteKit and Nuxt upload preparation used a minimal hand-written config.🤖 Generated with Claude Code