{{ message }}
feat(db-d1-sqlite): http transport for D1 via Cloudflare REST API#16269
Draft
JarrodMFlesch wants to merge 2 commits intomainfrom
Draft
feat(db-d1-sqlite): http transport for D1 via Cloudflare REST API#16269JarrodMFlesch wants to merge 2 commits intomainfrom
JarrodMFlesch wants to merge 2 commits intomainfrom
Conversation
Contributor
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.

Summary
Adds an optional
httpconfiguration to@payloadcms/db-d1-sqliteso D1 can be used from runtimes without a Workers binding (for example Node or Vercel) by calling Cloudflare’s D1 HTTP API. The adapter accepts either a Workersbindingorhttpcredentials, validates that they are not combined, and documents that read-replica session mode is Workers-only.Implements a small REST client (
prepare,batch,exec, andquery) plus Vitest coverage with mockedfetch. BecausedropDatabasein@payloadcms/drizzle/sqliteexpects a libsql-styleclient.executeAPI, connect wires a shim that mapsexecute/executeMultipleonto D1’sprepare().all()andexec, which fixesPAYLOAD_DROP_DATABASEand other code paths that assumed a libsql client.Adds an integration test under
test/d1-httpthat runs against a real D1 database whenCLOUDFLARE_ACCOUNT_ID,CLOUDFLARE_D1_DATABASE_ID, andCLOUDFLARE_API_TOKENare set, and skips otherwise. README updates describe Workers vs HTTP usage and environment variables.