Working on fullstack Astro Cloudflare starter. Trying to integrate Lucia auth with Drizzle and Cloudflare d1. Lucia docs are barebones and imprecise. Luckily this video helped a lot! https://www.youtube.com/watch?v=urAHMyBXM6kÏÍ
Discovering lots of weird quirks with Cloudflare Pages. The hardest thing to reason about is discrepancies between local and dev and production
The main thing to remember is local dev is not a Cloudflare runtime so we need to be conscious of library choices. This is not a bad thing really…
Environment variables are weird:
-
Pushing a local codebase to cloudflare pages, it absorbs the the envs you have specified in your
.env
. -
Using a GitHub branch deployment, environment variables specified can’t be access via Astros
import.meta.env
. Instead they appear to be injected into Cloudflare runtime and can be accessed into theAstro.locals.runtime
. this object is available on astro file and middleware. https://docs.astro.build/en/guides/integrations-guide/cloudflare/#cloudflare-runtime- to use development secrests use a
.dev.vars
file.
- to use development secrests use a