localer
CDCloudflare Developers
•Created by localer on 3/13/2025 in #pages-help
Sveltekit: adapter-static with Cloudflare D1 - platform.env.DB not found during build
I'm using SvelteKit with
adapter-static
, but I want to use Cloudflare D1 for database queries. I created the D1 database using pnpm wrangler d1 create
, and everything seems fine.
However, when I try to build my project, I get an error saying that platform.env.DB
is not found. Since adapter-static
generates a fully static site, is there any way to still use D1 in this setup?
Do I need to switch to adapter-cloudflare
, or is there another way to access D1 while keeping adapter-static
? Any guidance would be appreciated.1 replies