drizzle-team / drizzle-orm

Headless TypeScript ORM with a head. Runs on Node, Bun and Deno. Lives on the Edge and yes, it's a JavaScript ORM too 😅
https://orm.drizzle.team
Apache License 2.0
23.81k stars 590 forks source link

[BUG]: "Please install `postgres`to allow Drizzle ORM to connect to the database" 0.35.0 #3134

Open igoramadas opened 20 hours ago

igoramadas commented 20 hours ago

What version of drizzle-orm are you using?

0.35.0

What version of drizzle-kit are you using?

0.26.1

Describe the Bug

Since updating from 0.34.x to 0.35.0, I'm getting the following error when building my app:

Argument of type 'Sql<{}>' is not assignable to parameter of type '"Please install postgres to allow Drizzle ORM to connect to the database"'

But postgres (postgres-js) is already installed.

A sample code that triggers the error for me:

import {drizzle, type PostgresJsDatabase} from "drizzle-orm/postgres-js"
import postgres from "postgres"
import * as schema from "./schema.js"
import settings from "./settings.json"

const pg = postgres(settings.database, {max: 10, onnotice: () => {}})
const client:PostgresJsDatabase<typeof schema> = drizzle(pg) // build error here

My drizzle.config.json file:

{
    "dialect": "postgresql",
    "schema": "./src/database/schema.ts",
    "out": ".drizzle"
}

I have cleared the node_modules and my Nuxt output and built everything from scratch, but error is still there.

Reverting to 0.34.1 fixes the problem for now.

Expected behavior

No response

Environment & setup

yfandino commented 9 hours ago

I faced the same issue. In my case I am using pg package. I solved it by installing @types/pg

Sukairo-02 commented 6 hours ago

@igoramadas could you please make reproduction repo or share your current one?