third774 / astro-d1-drizzle-demo

11 stars 1 forks source link

error occurred after npx @astrojs/upgrade #3

Open Glowin opened 2 months ago

Glowin commented 2 months ago

When I upgraded Astro from 4.4.12 to the latest 4.7.1 using npx @astrojs/upgrade, and reran npm run dev, I encountered an error with the following message:

Cannot read properties of undefined (reading 'env')

image

So I modified the erroneous code to const db = drizzle(import.meta.env.DB);, but then a new error appeared, which seems to be an issue with drizzle-orm‘s compatibility:

image

timleers commented 2 months ago

this happens because the astro/cloudflare plugin has changed. can you try this:

  adapter: cloudflare({
    platformProxy: {
      enabled: true,
    },
  }),

instead of the old adapter in astro.config.mjs. if this works for you i will create a PR to fix this here