Drizzle TeamDT
Drizzle Team13mo ago
3 replies
Udlei Nati

Could not find package 'postgres' from referrer 'file:///deno-dir/npm/registry.npmjs.org/drizzle-orm

I replied to this issue with the example that I'm posting here:
https://github.com/drizzle-team/drizzle-orm/issues/3748

I'm following the error:
error: Could not find package 'postgres' from referrer 'file:///deno-dir/npm/registry.npmjs.org/drizzle-orm/0.38.3/postgres-js/driver.js' (drizzle-orm@0.38.3).


You might not get the error if you have postgres package installed globally via npm. To easily reproduce it, try running it using Docker:

Create a file named main.ts with the following content:

import { drizzle } from 'npm:drizzle-orm@0.38.3/postgres-js';
import postgresjs from 'https://deno.land/x/postgresjs@v3.4.5/mod.js';
const queryClient = postgresjs('postgresql://postgres:infrapsp@localhost:5432/main');
const db = drizzle(queryClient);
const result = await db.execute('select 1');
console.log(result);


Now let's run it using Docker:

docker run -v $(pwd):/app -it denoland/deno:alpine-2.1.4 sh


Run this command:

deno run /app/main.ts


You'll see the following error:

error: Could not find package 'postgres' from referrer 'file:///deno-dir/npm/registry.npmjs.org/drizzle-orm/0.38.3/postgres-js/driver.js' (drizzle-orm@0.38.3).


If we switch to using postgres from npm instead of deno, it works for connections without SSL, but with SSL enabled, it returns another error:

error: Uncaught (in promise) Error: write CONNECT_TIMEOUT undefined:undefined


The way to go it to keep it as it was in drizzle 0.30, this issue started to happening after 0.31.

Does anyone have any suggestions on how to solve this issue?

Best
GitHub
Report hasn't been filed before. 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...
[BUG]: Using an existing `postgres-js` driver throws could not find...
Was this page helpful?