Is it possible to debug D1 databases and/or durable objects locally? #78
-
It seems that |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
For durable objects: In production (running on cloudflare via denoflare push) The "bindings": {
"backendNamespace": { "doNamespace": "backend-prod:BackendDO" },
} For local serving, you can use a binding value of "bindings": {
"backendNamespace": { "doNamespace": "local:BackendDO" },
} or you can add a few options to the local backend for persistent storage, "bindings": {
"backendNamespace": { "doNamespace": "local:BackendDO:storage=webstorage:container=mp1-local" },
} D1 support in denoflare is newer, but in all cases you set the "bindings": {
"db1": { "d1DatabaseUuid": "6a34fd2e-8cc4-4f74-8722-3c4373788793" },
} In production, that specifies the D1 database UUID. See In development, D1 is backed by a local SQLite database, and the guid defines the container. |
Beta Was this translation helpful? Give feedback.
For durable objects:
In production (running on cloudflare via denoflare push) The
doNamespace
binding value looks like:my-do-namespace-name:MyDOClass
For local serving, you can use a binding value of
local:MyDOClass
, which will instantiate your DO class locally and use an in-memory version for transactional storage (no persistence)or
you can add a few options to the local backend for persistent storage,
storage=webstorage
and name the local storage containercontainer=my-container-name