sonicjs icon indicating copy to clipboard operation
sonicjs copied to clipboard

D1 driver, the client passed to SQLiteD1Session is undefined, causing client.prepare to throw.

Open jazzjoe opened this issue 1 year ago • 1 comments

When using the D1 driver, the client passed to SQLiteD1Session is undefined, causing client.prepare to throw. Can we add a null check or ensure the driver is correctly passed?

I am using default setup as in readme.md and got error on first pnpm dev

jazzjoe avatar Apr 04 '25 05:04 jazzjoe

in worker-configuration.d.ts:

declare namespace Cloudflare { interface Env { DISABLED_CACHE: true; DB: D1Database; } }

update to declare namespace Cloudflare { interface Env { DISABLED_CACHE: true; D1: D1Database; } }

in wrangler.toml,

change binding = "DB" to binding = "D1"

it works for me

jazzjoe avatar Apr 04 '25 05:04 jazzjoe

Closing this issue as it's no longer relevant following the SonicJS 2.0 rewrite. The 2.0 version is a complete architectural overhaul with significant improvements to the core framework. If you encounter similar issues with 2.0, please open a new issue with updated details. Thank you!

lane711 avatar Nov 14 '25 01:11 lane711