ResolveMessage error when trying to run a query with drizzle postgres and bun

I have created a bun project with bun 1.0.6 and added drizzle-orm and postgres. I am trying to execute a basic query with this code:
import { sql } from "drizzle-orm"
import { drizzle } from "drizzle-orm/postgres-js"
import postgres from "postgres"

const client = postgres("postgres://localhost/my_db")
console.log("Created client")

const db = drizzle(client)
console.log("Created db")

const user = await db.execute(sql`select first_name from users where id = 1`)

console.log(`user: ${user}`)
import { sql } from "drizzle-orm"
import { drizzle } from "drizzle-orm/postgres-js"
import postgres from "postgres"

const client = postgres("postgres://localhost/my_db")
console.log("Created client")

const db = drizzle(client)
console.log("Created db")

const user = await db.execute(sql`select first_name from users where id = 1`)

console.log(`user: ${user}`)
But when I run it with bun run index.ts, I get this error:
Created client
Created db
error: ResolveMessage
Created client
Created db
error: ResolveMessage
Anyone know what might be wrong here?
9 Replies
jsoneaday
jsoneaday13mo ago
Hi did you ever figure this out? I'm also trying to use Bund and Drizzle together, but I'm having the same error when I try and deploy a drizzle-kit migration
const migrationClient = postgres(db_conn, { max: 1 });
const migrationsPath = path.join(__dirname, "../../drizzle");
const folderExists = fs.existsSync(migrationsPath);
console.log("migrationsPath:", migrationsPath, "folderExists:", folderExists);

console.log("migrating...");
await migrate(drizzle(migrationClient), { migrationsFolder: migrationsPath });
const migrationClient = postgres(db_conn, { max: 1 });
const migrationsPath = path.join(__dirname, "../../drizzle");
const folderExists = fs.existsSync(migrationsPath);
console.log("migrationsPath:", migrationsPath, "folderExists:", folderExists);

console.log("migrating...");
await migrate(drizzle(migrationClient), { migrationsFolder: migrationsPath });
adiSuper94
adiSuper9413mo ago
+1 facing the same issue facing this issue, on code that worked 2 weeks ago !
adiSuper94
adiSuper9413mo ago
GitHub
Drizzle + postgres not working with bun . Getting error: ResolveMes...
What version of Bun is running? 1.0.6 What platform is your computer? Darwin 21.6.0 x86_64 i386 What steps can reproduce the bug? package.json { "name": "drizzlebuntest", "...
Angelelz
Angelelz13mo ago
I was able to reproduce, I added a quick repro. Thanks for raising the issue there
adiSuper94
adiSuper9413mo ago
Thanks!
adiSuper94
adiSuper9413mo ago
FYI: The issue might to be with postgres and not drizzle.
GitHub
GitHub - porsager/postgres: Postgres.js - The Fastest full featured...
Postgres.js - The Fastest full featured PostgreSQL client for Node.js, Deno, Bun and CloudFlare - GitHub - porsager/postgres: Postgres.js - The Fastest full featured PostgreSQL client for Node.js, ...
Angelelz
Angelelz13mo ago
Well, if it didn't work with node, I would agree. But it works with node It's a bun issue
adiSuper94
adiSuper9413mo ago
Oh yes, I agree. I meant bun's issue is with working with postgres and not drizzle. This issue might be affecting us transitively.
Angelelz
Angelelz13mo ago
Just use pg for the time being. or Node
Want results from more Discord servers?
Add your server