drizzle-team / drizzle-team/drizzle-orm
[BUG]: `Error: No such module "wrangler".` in D1
- Dominant language
- TypeScript
- Stars
- 35.8k
- Forks
- 1.6k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 4
Description
### Report hasn't been filed before.
- [x] I have verified that the bug I'm about to report hasn't been filed before.
### What version of `drizzle-orm` are you using?
0.40.0
### What version of `drizzle-kit` are you using?
0.30.5
### Other packages
_No response_
### Describe the Bug
When using OpenNext, Drizzle, and the D1 database following the Docs below, I get the error `Error: No such module "wrangler".`.
It works locally, but when I deploy to Cloudflare Workers I start getting errors.
https://orm.drizzle.team/docs/get-started/d1-new
Details of the packages, configuration files, etc. are as follows:
packages: `next@15.2.2, @opennextjs/cloudflare@0.5.10, wrangler@3.114.0`
`drizzle.config.ts`
```ts
import { defineConfig } from 'drizzle-kit';
export default defineConfig({
out: './drizzle',
schema: './schema',
dialect: 'sqlite',
driver: 'd1-http',
dbCredentials: {
accountId: process.env.CLOUDFLARE_ACCOUNT_ID!,
databaseId: process.env.CLOUDFLARE_DATABASE_ID!,
token: process.env.CLOUDFLARE_D1_TOKEN!,
},
casing: 'snake_case',
});
```
`database.ts`
```ts
import { getCloudflareContext } from '@opennextjs/cloudflare';
import { drizzle } from 'drizzle-orm/d1';
export const db = drizzle(
(await getCloudflareContext({ async: true })).env.DB,
{ casing: 'snake_case' },
);
```
Contributor guide
Assessment
This issue has not been assessed yet.