Warning: You need to pass an instance of Client:

I'm getting this warning as described here: https://orm.drizzle.team/docs/latest-releases/drizzle-orm-v0294 Using drizzle-orm 0.31.4. But I'm already using a client instance:
import { Client } from '@planetscale/database'
import { drizzle } from 'drizzle-orm/planetscale-serverless'

const db = drizzle(new Client({ url: dbUrl }), { schema })
import { Client } from '@planetscale/database'
import { drizzle } from 'drizzle-orm/planetscale-serverless'

const db = drizzle(new Client({ url: dbUrl }), { schema })
Warning:
Warning: You need to pass an instance of Client:
import { Client } from "@planetscale/database";
const client = new Client({
host: process.env["DATABASE_HOST"],
username: process.env["DATABASE_USERNAME"],
password: process.env["DATABASE_PASSWORD"],
});
const db = drizzle(client);
Starting from version 0.30.0, you will encounter an error if you attempt to use anything other than a Client instance.
Please make the necessary changes now to prevent any runtime errors in the future
Warning: You need to pass an instance of Client:
import { Client } from "@planetscale/database";
const client = new Client({
host: process.env["DATABASE_HOST"],
username: process.env["DATABASE_USERNAME"],
password: process.env["DATABASE_PASSWORD"],
});
const db = drizzle(client);
Starting from version 0.30.0, you will encounter an error if you attempt to use anything other than a Client instance.
Please make the necessary changes now to prevent any runtime errors in the future
Drizzle ORM - DrizzleORM v0.29.4 release
Drizzle ORM is a lightweight and performant TypeScript ORM with developer experience in mind.
3 Replies
Alexandru
AlexandruOP7mo ago
I modified the code and I'm still getting the same warning:
const client = new Client({
host: ``,
username: ``,
password: ``
})

const db = drizzle(client, {
schema
})
const client = new Client({
host: ``,
username: ``,
password: ``
})

const db = drizzle(client, {
schema
})
any ideas?
Julian1001
Julian10016mo ago
I get the same, did you find a solution?
sbbu
sbbu4mo ago
getting the same thing, now drizzle throws an arbitrary error over this console.log(client instanceof Client) even outputs true but by the time its passed down to driver.js it no longer does

Did you find this page helpful?