You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using next.js 14 with cloudflare D1. I have everything running locally running drizzle queries fine no problem. However when building the project to push to Cloudflare pages:build, I get
Failed to retrieve the Cloudflare request context
If I use cloudflare api instead of drizzle it works. Cloudflare has same tables as local.
import * as users from './schema/users';
import * as projects from './schema/projects';
import * as userOnProjects from './schema/userOnProjects';
import { drizzle } from 'drizzle-orm/d1';
import { getRequestContext } from '@cloudflare/next-on-pages'
const db = drizzle(getRequestContext().env.DB, { schema: { ...users, ...projects, ...userOnProjects } });
export default db;
wrangler.toml
[[d1_databases]]
binding = "DB" # i.e. available in your Worker on env.DB
database_name = "split-sonic-prod"
database_id = "d57bbc32-b607-4c39-81ff-e82d6b43cb0c"
preview_database_id = "DB"
[env.preview]
name = "preview"
[[env.preview.d1_databases]]
binding = "DB" # i.e. available in your Worker on env.DB
database_name = "split-sonic-preview"
database_id = "e91bfc73-92c6-4551-b2c2-576a0eb4d50b"
Expected behavior
Cloudflare D1 to work with Drizzle on Cloudflare workers.
Environment & setup
Cloudflare pages:build
The text was updated successfully, but these errors were encountered:
What version of
drizzle-orm
are you using?^0.30.4
What version of
drizzle-kit
are you using?^0.20.14
Describe the Bug
I'm using next.js 14 with cloudflare D1. I have everything running locally running drizzle queries fine no problem. However when building the project to push to Cloudflare
pages:build
, I getFailed to retrieve the Cloudflare request context
If I use cloudflare api instead of drizzle it works. Cloudflare has same tables as local.
/api/projects/routes.ts
drizzle.ts
wrangler.toml
Expected behavior
Cloudflare D1 to work with Drizzle on Cloudflare workers.
Environment & setup
Cloudflare
pages:build
The text was updated successfully, but these errors were encountered: