'@neondatabase/serverless' can only connect to remote Neon/Vercel Postgres/Supabase instances

how to suppress this warning or remove this error?
No description
6 Replies
Deragon
DeragonOP7mo ago
No description
elitenoire
elitenoire7mo ago
Have you found solution? I’m having the same warning when using the drizzle kit.
Mykhailo
Mykhailo7mo ago
Hey guys. If you use neon driver with non-neon database you should use pool connection and drizzle-orm/neon-serverless like here:
import { Pool } from '@neondatabase/serverless';
import { drizzle } from 'drizzle-orm/neon-serverless';

const pool = new Pool({ connectionString: env.DATABASE_URL });
const db = drizzle(pool)
import { Pool } from '@neondatabase/serverless';
import { drizzle } from 'drizzle-orm/neon-serverless';

const pool = new Pool({ connectionString: env.DATABASE_URL });
const db = drizzle(pool)
elitenoire
elitenoire7mo ago
@Mykhailo thanks but what do you mean by non-neon database? do you mean drizzle? The connection is still working using the neon-http setup. Do you know the danger the websocket warning is trying to prevent? Although this is in local dev, I haven't pushed to production yet.
Mykhailo
Mykhailo7mo ago
Sorry, I understood that it is with Drizzle kit. There is no any danger, it just says that in this case websocket should be used
elitenoire
elitenoire7mo ago
@Deragon @Mykhailo Okay. I have figured out something. Drizzle-kit will use the pg driver, so only have to install it as a dev dependency. Otherwise, it will want to use the neon serverless driver which will result to the error warning. We can still use the neon-http setup to query the database instead of the websocket.
Want results from more Discord servers?
Add your server