Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]: TypeScript error Please install '@neondatabase/serverless' to allow Drizzle ORM to connect to the database #3521

Closed
1 task done
fisenkodv opened this issue Nov 10, 2024 · 8 comments
Labels
bug Something isn't working priority Will be worked on next

Comments

@fisenkodv
Copy link

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.36.1

What version of drizzle-kit are you using?

0.28.0

Other packages

@neondatabase/serverless@0.10.3

Describe the Bug

TypeScript error Please install @neondatabase/serverless to allow Drizzle ORM to connect to the database when calling drizzle.

Example from here https://orm.drizzle.team/docs/tutorials/drizzle-with-neon#connect-drizzle-orm-to-your-database

import { drizzle } from 'drizzle-orm/neon-http';
import { neon } from '@neondatabase/serverless';
import { config } from 'dotenv';

config({ path: '.env' }); // or .env.local

const sql = neon(process.env.DATABASE_URL!);

export const db = drizzle({ client: sql });

build fails with the following error

build: ./db/db.ts:9:27
build: Type error: Argument of type '{ client: NeonQueryFunction<false, false>; }' is not assignable to parameter of type '"Please install `@neondatabase/serverless` to allow Drizzle ORM to connect to the database"'.
build:
build:    7 | const sql = neon(process.env.DATABASE_URL!);
build:    8 |
build: >  9 | export const db = drizzle({ client: sql });
build:      |                           ^
build:   10 |
@fisenkodv fisenkodv added the bug Something isn't working label Nov 10, 2024
@IncognitoTGT
Copy link

the proper syntax would be

const db = drizzle(sql);

@fisenkodv
Copy link
Author

the proper syntax would be

const db = drizzle(sql);

it also doesn't work properly

import { neon } from '@neondatabase/serverless';
import { drizzle } from 'drizzle-orm/neon-http';

const sql = neon(process.env.POSTGRES_URL!);

export const db = drizzle(sql);

same error

Argument of type 'NeonQueryFunction<false, false>' is not assignable to parameter of type '"Please install @neondatabase/serverless to allow Drizzle ORM to connect to the database"'.ts(2345)

@IncognitoTGT
Copy link

did you also install the package?

@fisenkodv
Copy link
Author

fisenkodv commented Nov 12, 2024

The issue with strict TS parameter, when it set to false. If set to true the error gone. Ideally, no matter what strict value is, it should work, IMO. But as a workaround, strict can be set to true.

@clearly-outsane
Copy link

I'm having this issue too

@L-Mario564 L-Mario564 added the priority Will be worked on next label Nov 14, 2024
@AlexBlokh
Copy link
Contributor

can you please prepare a minimal reproducible example?

@tobychidi
Copy link

tobychidi commented Nov 16, 2024

I got this as well

Argument of type '{ connection: string; schema: typeof schema; casing: string; }' is not assignable to parameter of type '"Please install `postgres` to allow Drizzle ORM to connect to the database"'.

And I did install Postgres. Setting strict to true, cleared it up.

Here is a reprod: tobychidi/drizzle-lab-reprod

Check the tsconfig in the file root. You can set compilerOptions.strict: false and see.

Additional details

Microsoft Windows 11 Pro
WINNT

@AlexBlokh
Copy link
Contributor

we'll switch it off, that's a nice little check, but unfortunately it for some reason doesn't work with strict: false :/

PR is prepared by @Sukairo-02, landing in next beta release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working priority Will be worked on next
Projects
None yet
Development

No branches or pull requests

6 participants