T O
T O
DTDrizzle Team
Created by T O on 11/7/2023 in #help
Error: this.client.prepare is not a function
I am trying to build a project using Bun, Hono and Drizzle. When i am starting the project with this piece of code :
import { Hono } from 'hono'
import postgres from 'postgres';
import {drizzle} from 'drizzle-orm/d1';
import {migrate} from 'drizzle-orm/d1/migrator';

const sql = postgres(process.env.DATABASE_URL, { max: 1 });
const db = drizzle(sql);

await migrate(db, { migrationsFolder: "drizzle" });

const app = new Hono();
app.get('/', (c) => c.text('Hello Hono!'));

export default app;
import { Hono } from 'hono'
import postgres from 'postgres';
import {drizzle} from 'drizzle-orm/d1';
import {migrate} from 'drizzle-orm/d1/migrator';

const sql = postgres(process.env.DATABASE_URL, { max: 1 });
const db = drizzle(sql);

await migrate(db, { migrationsFolder: "drizzle" });

const app = new Hono();
app.get('/', (c) => c.text('Hello Hono!'));

export default app;
I am encountering this error :
DrizzleError: Failed to run the query '
CREATE TABLE IF NOT EXISTS "__drizzle_migrations" (
id SERIAL PRIMARY KEY,
hash text NOT NULL,
created_at numeric
)
': this.client.prepare is not a function. (In 'this.client.prepare(query.sql)', 'this.client.prepare' is undefined)
DrizzleError: Failed to run the query '
CREATE TABLE IF NOT EXISTS "__drizzle_migrations" (
id SERIAL PRIMARY KEY,
hash text NOT NULL,
created_at numeric
)
': this.client.prepare is not a function. (In 'this.client.prepare(query.sql)', 'this.client.prepare' is undefined)
I've run the drizzle-kit generate:pg command before and I've checked my connection string many times Thank you for your help 🙂
2 replies