René's URL Explorer Experiment


Title: SvelteKit: a third-party package's `void/db` gets the D1 client in dev, and pg/MySQL builds inline workerd-only dependency code · Issue #420 · voidzero-dev/void · GitHub

Open Graph Title: SvelteKit: a third-party package's `void/db` gets the D1 client in dev, and pg/MySQL builds inline workerd-only dependency code · Issue #420 · voidzero-dev/void

X Title: SvelteKit: a third-party package's `void/db` gets the D1 client in dev, and pg/MySQL builds inline workerd-only dependency code · Issue #420 · voidzero-dev/void

Description: Problem a. A package that imports void/db gets the D1 client in dev In a SvelteKit app with database: 'pg' (or MySQL), the app's own void/db is the generated pg client. A package in node_modules that imports void/db gets Void's static D1...

Open Graph Description: Problem a. A package that imports void/db gets the D1 client in dev In a SvelteKit app with database: 'pg' (or MySQL), the app's own void/db is the generated pg client. A package in node_modules th...

X Description: Problem a. A package that imports void/db gets the D1 client in dev In a SvelteKit app with database: 'pg' (or MySQL), the app's own void/db is the generated pg client. A package in nod...

Opengraph URL: https://github.com/voidzero-dev/void/issues/420

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"SvelteKit: a third-party package's `void/db` gets the D1 client in dev, and pg/MySQL builds inline workerd-only dependency code","articleBody":"## Problem\n\n### a. A package that imports `void/db` gets the D1 client in dev\n\nIn a SvelteKit app with `database: 'pg'` (or MySQL), the app's own `void/db` is the generated pg client. A package in `node_modules` that imports `void/db` gets Void's static D1 client instead. Using it throws:\n\n```\ndb: Missing Cloudflare binding 'DB'. This app connects through HYPERDRIVE or DATABASE_URL, but its server\nbundle loaded the D1 client. In Nuxt or Analog, add 'void/nitro' to the Nitro modules.\n```\n\nThe message also points SvelteKit users to Nuxt and Analog, which does not help them.\n\n```\napp route ── import 'void/db' ──> Vite SSR graph ──> generated pg client      (ok)\nxa-db-lib ── import 'void/db' ──> Node (package is external) ──> dist/runtime/db.mjs (D1 client)\n```\n\n### b. pg/MySQL builds inline workerd-only dependency code (risk)\n\nFor SvelteKit pg/MySQL builds, #413 builds Kit's `ssr` environment for workerd: `resolve.noExternal: true`, `workerd`/`worker` conditions and neutral output. Kit's analyse step then loads that output in Node. A dependency whose `workerd` build statically imports a `cloudflare:` module would now be bundled into that output, and Node cannot load it (`ERR_UNSUPPORTED_ESM_URL_SCHEME`). Before #413 such a dependency stayed external, and Node loaded its Node build.\n\n**This was seen only with a synthetic package** (`exports: { workerd: './cf.js', default: './node.js' }`, where `cf.js` has `import { connect } from 'cloudflare:sockets'`). The server entry then started with `import \"cloudflare:sockets\"`. No real package has been shown to break. `pg` is fine: `pg-cloudflare` imports `cloudflare:sockets` lazily.\n\n## Repro\n\na.\n1. SvelteKit app, `void.config.ts` with `database: 'pg'`, a pg schema, and `DATABASE_URL` in `.env`.\n2. Add `node_modules/xa-db-lib/index.js`:\n   ```js\n   import { db } from 'void/db';\n   export function libDb() {\n     try { return { execute: typeof db.execute }; } catch (e) { return { error: String(e) }; }\n   }\n   ```\n3. Add `src/routes/api/lib/+server.ts`, which returns `{ app: typeof db.execute, lib: libDb() }`.\n4. `vp dev`, request `/api/lib`:\n   ```json\n   {\"app\":{\"execute\":\"function\",\"run\":\"undefined\"},\"lib\":{\"error\":\"Error: db: Missing Cloudflare binding 'DB'. ...\"}}\n   ```\n\nb. Add a dependency whose `workerd` export statically imports `cloudflare:sockets`, import it from server code in a SvelteKit pg app, and run `vp build`.\n\n## Cause\n\n- a. Vite's SSR graph externalizes a package that resolves into `node_modules`. Void inlines only `void` itself (`packages/void/src/plugin-framework.ts:232`, `ssr.noExternal: ['void']`). The external package's `void/db` goes to the package export `./dist/runtime/db.mjs`, the static D1 client (`packages/void/src/runtime/db.ts:59-70`). `packages/void/AGENTS.md:101` notes that such packages load their own env module copies; `void/db` has the same limit.\n- b. `packages/void/src/plugin-framework.ts:310-330` (`void:sveltekit-worker-build`): `noExternal: true` at `:325`, conditions at `:322`, `platform: 'neutral'` at `:329`.\n\n## Suggested fix\n\n- a. In SvelteKit dev, inline packages that import `void/*` (for example, find them in the dependency graph and add them to `ssr.noExternal`). At least, make the D1 client's error name the real cause for SvelteKit.\n- b. Inline only the driver chain that `void/db` needs (`void`, `drizzle-orm`, `pg`, `pg-*`, `mysql2` and their dependencies), and leave other dependencies to Kit's Node resolution. Or document the limit. Check real packages first, for example `postgres` (its `cloudflare` build).\n\n## Evidence\n\n- a. Reproduced at the head of #413 with a workspace-linked `void` (response above). #413 makes the app's own `void/db` work with an installed `void`; it does not change a third-party package's import, and it adds the Nuxt/Analog wording to the error.\n- b. Synthetic probe only, built with the head of #413. The SvelteKit build plugin is new in #413 (`bd1705f26`); before it, pg/MySQL SvelteKit Workers failed at request time instead.\n\n🤖 Generated with [Claude Code](https://claude.com/claude-code)\n\nhttps://claude.ai/code/session_0123r5HnanmW2VUrZ7VWDufH\n","author":{"url":"https://github.com/Brooooooklyn","@type":"Person","name":"Brooooooklyn"},"datePublished":"2026-10-14T04:05:36Z","url":"https://github.com/voidzero-dev/void/issues/420"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:f99192e8-e715-af9b-8893-2e8317906b30
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id9440:1ED5BC:2D482D:3D46E4:6AFBA150
html-safe-nonceba4428497a218f107812a44a5a4eec3c67956c9d4308fb4310992e7ad2dba11e
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NDQwOjFFRDVCQzoyRDQ4MkQ6M0Q0NkU0OjZBRkJBMTUwIiwidmlzaXRvcl9pZCI6IjQzMjQwMTA0MzM1ODYxMTA4MDAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmaccd0a8b87c7d74016cfc7b55d1a75182b57083bf91fa4b7ce333c19d879fcbaaf
hovercard-subject-tagissue:5841739219
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/voidzero-dev/void/420/issue_layout
twitter:imagehttps://opengraph.githubassets.com/db26a38068df2a27ac400c99ae195969779120f71b4f5b29b9d2a612443a599e/voidzero-dev/void/issues/420
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/db26a38068df2a27ac400c99ae195969779120f71b4f5b29b9d2a612443a599e/voidzero-dev/void/issues/420
og:image:altProblem a. A package that imports void/db gets the D1 client in dev In a SvelteKit app with database: 'pg' (or MySQL), the app's own void/db is the generated pg client. A package in node_modules th...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameBrooooooklyn
hostnamegithub.com
expected-hostnamegithub.com
None3cefd19a936819d82cfb5279d50fb56fe79cb9ec30f0f807e04e89b0c58ffae1
turbo-cache-controlno-preview
go-importgithub.com/voidzero-dev/void git https://github.com/voidzero-dev/void.git
octolytics-dimension-user_id149750581
octolytics-dimension-user_loginvoidzero-dev
octolytics-dimension-repository_id1164437080
octolytics-dimension-repository_nwovoidzero-dev/void
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id1164437080
octolytics-dimension-repository_network_root_nwovoidzero-dev/void
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release606800bdb1b81d125fc845bdcc262c9fe063fc8f
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/voidzero-dev/void/issues/420#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fvoidzero-dev%2Fvoid%2Fissues%2F420
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fvoidzero-dev%2Fvoid%2Fissues%2F420
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=voidzero-dev%2Fvoid
Reloadhttps://github.com/voidzero-dev/void/issues/420
Reloadhttps://github.com/voidzero-dev/void/issues/420
Reloadhttps://github.com/voidzero-dev/void/issues/420
voidzero-devhttps://github.com/voidzero-dev
voidhttps://github.com/voidzero-dev/void
Codehttps://github.com/voidzero-dev/void
Issues29 (29)https://github.com/voidzero-dev/void/issues
Pull requests10 (10)https://github.com/voidzero-dev/void/pulls
Discussionshttps://github.com/voidzero-dev/void/discussions
Actionshttps://github.com/voidzero-dev/void/actions
Security and qualityhttps://github.com/voidzero-dev/void/security
Insightshttps://github.com/voidzero-dev/void/pulse
https://github.com/voidzero-dev/void
New issuehttps://github.com/login?return_to=https://github.com/voidzero-dev/void/issues/420
New issuehttps://github.com/login?return_to=https://github.com/voidzero-dev/void/issues/420
#413https://github.com/voidzero-dev/void/pull/413
SvelteKit: a third-party package's void/db gets the D1 client in dev, and pg/MySQL builds inline workerd-only dependency codehttps://github.com/voidzero-dev/void/issues/420#top
#413https://github.com/voidzero-dev/void/pull/413
bugSomething isn't workinghttps://github.com/voidzero-dev/void/issues?q=state%3Aopen%20label%3A%22bug%22
https://github.com/Brooooooklyn
Brooooooklynhttps://github.com/Brooooooklyn
on Oct 14, 2026https://github.com/voidzero-dev/void/issues/420#issue-5841739219
#413https://github.com/voidzero-dev/void/pull/413
#413https://github.com/voidzero-dev/void/pull/413
fix(void): make PostgreSQL and MySQL void/db work across frameworks, builds and deploys #413https://github.com/voidzero-dev/void/pull/413
fix(void): make PostgreSQL and MySQL void/db work across frameworks, builds and deploys #413https://github.com/voidzero-dev/void/pull/413
fix(void): make PostgreSQL and MySQL void/db work across frameworks, builds and deploys #413https://github.com/voidzero-dev/void/pull/413
fix(void): make PostgreSQL and MySQL void/db work across frameworks, builds and deploys #413https://github.com/voidzero-dev/void/pull/413
Claude Codehttps://claude.com/claude-code
https://claude.ai/code/session_0123r5HnanmW2VUrZ7VWDufHhttps://claude.ai/code/session_0123r5HnanmW2VUrZ7VWDufH
Brooooooklynhttps://github.com/Brooooooklyn
bugSomething isn't workinghttps://github.com/voidzero-dev/void/issues?q=state%3Aopen%20label%3A%22bug%22
on Oct 14, 2026https://github.com/voidzero-dev/void/issues/420#event-33193191449
Brooooooklynhttps://github.com/Brooooooklyn
on Oct 14, 2026https://github.com/voidzero-dev/void/issues/420#event-33206288158
fix(void): bundle installed void packages for the Node target and Sve…https://github.com/voidzero-dev/void/commit/4abec3c62cb0b9a8aa3d6a4026ae1c8693efc9c9
https://docs.github.com/articles/closing-issues-via-commit-messages
4abec3chttps://github.com/voidzero-dev/void/commit/4abec3c62cb0b9a8aa3d6a4026ae1c8693efc9c9
fix(void): bundle installed void packages for the Node target and Sve…https://github.com/voidzero-dev/void/commit/cdf8874a4826f1d418dd6c0a1ea3368789303bd2
https://docs.github.com/articles/closing-issues-via-commit-messages
cdf8874https://github.com/voidzero-dev/void/commit/cdf8874a4826f1d418dd6c0a1ea3368789303bd2
fix(void): bundle installed void packages for the Node target and Sve…https://github.com/voidzero-dev/void/commit/85657c602b02810066d55a42d58120e7646b2fc1
https://docs.github.com/articles/closing-issues-via-commit-messages
85657c6https://github.com/voidzero-dev/void/commit/85657c602b02810066d55a42d58120e7646b2fc1
fix(void): bundle installed void packages for the Node target and Sve…https://github.com/voidzero-dev/void/commit/39d8dab645c9b4ce32d83d352ea460aa8aaf4b0d
https://docs.github.com/articles/closing-issues-via-commit-messages
39d8dabhttps://github.com/voidzero-dev/void/commit/39d8dab645c9b4ce32d83d352ea460aa8aaf4b0d
fix(void): bundle installed void packages for the Node target and Sve…https://github.com/voidzero-dev/void/commit/afe14709ccd012e73f743b577f058f0ac7ec4f57
https://docs.github.com/articles/closing-issues-via-commit-messages
afe1470https://github.com/voidzero-dev/void/commit/afe14709ccd012e73f743b577f058f0ac7ec4f57
Brooooooklynhttps://github.com/Brooooooklyn
completedhttps://github.com/voidzero-dev/void/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
#413https://github.com/voidzero-dev/void/pull/413
on Oct 14, 2026https://github.com/voidzero-dev/void/issues/420#event-33218437805
Sign up for freehttps://github.com/signup?return_to=https://github.com/voidzero-dev/void/issues/420
Sign in to commenthttps://github.com/login?return_to=https://github.com/voidzero-dev/void/issues/420
bugSomething isn't workinghttps://github.com/voidzero-dev/void/issues?q=state%3Aopen%20label%3A%22bug%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.