Repository navigation
Conversation
Local D1 bindings now go to workerd's D1 Worker, the bundled module
/workerd/d1.js, with {"database": "<id>"} in their props. Its Durable
Objects keep Miniflare's uniqueKey (miniflare-D1DatabaseObject) and
disk, so existing local databases are the same files; a database
written by the previous Miniflare reads back unchanged.
Miniflare's own D1 object (database.worker.ts) and its helpers are
removed. The entry worker, used by the local explorer and shared
storage to reach a database named at runtime, now forwards to workerd's
D1 through the debug port, as the KV entry worker does.
Tests: served_by is "workerd"; query() errors are named Error, not
D1_ERROR. Removed are three regression tests for failures writing the
session bookmark, which no longer writes. PRAGMA miniflare_d1_export,
for wrangler d1 export --local, is answered by workerd's D1, and the
export tests pass against it.
Needs a workerd release with workerd#8486, and generated/workerd.ts
regenerated from it so the config can carry Worker.Module.bundled;
until then the D1 tests fail.
🦋 Changeset detectedLatest commit: 9b1ac99 The changes in this PR will be included in the next version bump. This PR includes changesets to release 8 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
| { | ||
| name: D1_WORKERD_SERVICE_NAME, | ||
| worker: { | ||
| compatibilityDate: "2026-01-01", |
There was a problem hiding this comment.
The checked-in generated binding does not contain a bundled union member (or an _initBundled method). serializeConfig encodes modules by calling _init${capitalized}, so a worker with a local D1 binding currently throws TypeError: anyStruct._initBundled is not a function during startup. Please regenerate workerd.ts from the workerd release that introduces Worker.Module.bundled before merging.
|
I'm Bonk, and I've done a quick review of your PR. Summary: Replaces Miniflare’s D1 implementation with workerd’s bundled D1 worker.
|
@cloudflare/autoconfig
@cloudflare/build-output-utils
@cloudflare/codemods
@cloudflare/config
@cloudflare/containers-shared
create-cloudflare
@cloudflare/deploy-helpers
@cloudflare/kv-asset-handler
miniflare
@cloudflare/pages-functions
@cloudflare/pages-shared
@cloudflare/runtime-types
@cloudflare/unenv-preset
@cloudflare/vite-plugin
@cloudflare/vitest-plugin
@cloudflare/workers-auth
@cloudflare/workers-editor-shared
@cloudflare/workers-utils
wrangler
commit: |
This is part of the effort to merge celld into workerd, after KV (#16684). Over in workerd, cloudflare/workerd#8486 (landed) adds D1 as a bundled Worker,
/workerd/d1.js: each database is a SQLite-backed Durable Object, behind the existing D1 binding, serving both thequery()RPC and HTTP protocols, includingPRAGMA miniflare_d1_exportforwrangler d1 export --local.This PR switches Miniflare's local D1 over to it:
d1:workerdservice running/workerd/d1.js, with{"database": "<id>"}in their props.uniqueKey(miniflare-D1DatabaseObject) and disk, and a database written by the previous Miniflare reads back unchanged.database.worker.ts,schemas.ts,export.ts,dumpSql.ts) are removed: source +105 −869.Differences:
meta.served_byis"workerd", and errors thrown byquery()are namedErrorrather thanD1_ERROR; naming themD1_ERRORdoubles the prefix (D1_ERROR: D1_ERROR: ...) for callers withoutenhanced_error_serialization. Three regression tests about failures writing the session bookmark are removed, since bookmarks no longer write.Draft: this waits for a workerd release that includes #8486. The generated
workerd.tsis deliberately not regenerated here; it will be regenerated against that release (it needsWorker.Module.bundled), and until then the D1 tests fail. Against a local workerd build with #8486 and regenerated types, the D1 and local explorer tests pass (337 tests).