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).
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);
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
docker run -v $(pwd):/app -it denoland/deno:alpine-2.1.4 sh
Run this command:
deno run /app/main.ts
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).
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
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
[BUG]: Using an existing postgres-js driver throws could not find...
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...
3 Replies
Mario564
Mario5649mo ago
CC: @S. Reka
bira37
bira379mo ago
@Ling Mai Jiānguǒ @Mario564 i'm also having the same problem. Do you have any updates on this?
Mario564
Mario5649mo ago
Don't got any updates on my end. I haven't used Deno extensively so not sure what could be the issue here

Did you find this page helpful?