drizzle-team / drizzle-team/drizzle-orm

[BUG]: Using an existing `postgres-js` driver throws could not find package `postgres` error

Open
#3,748 10 comments 0 reactions 0 assignees View on GitHub
bug driver/postgresjs jsr/deno priority
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.38.0

### What version of `drizzle-kit` are you using?

0.30.0

### Other packages

https://deno.land/x/postgresjs@v3.4.5/mod.js

### Describe the Bug

Hello!

I'm running `drizzle-orm` with Deno 2.0 and using postgres-js driver from deno.land (https://deno.land/x/postgresjs@v3.4.5).

Following these steps from docs:

> If you need to provide your existing driver:

```js
// Make sure to install the 'postgres' package
import { drizzle } from 'drizzle-orm/postgres-js';
import postgres from 'postgres';
const queryClient = postgres(process.env.DATABASE_URL);
const db = drizzle({ client: queryClient });
const result = await db.execute('select 1');
```

I get this error: `Could not find package 'postgres' from referrer '[...]/node_modules/.deno/drizzle-orm@0.38.0/node_modules/drizzle-orm/postgres-js/driver.js'.`

Seems like it's expecting to have `postgres` installed from npm, even when using an existing driver.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.