NeonDbError: Error connecting to database

I got this error in connecting to my db on neon postgres, couldn't figure out why, I've tried both http and websocket connection to connect to my database, but nothing worked as expected, and also drizzle studio didn't work either, and I got this on error on drizzle studio "@Neondatabase/serverless' can only connect to remote Neon/Vercel Postgres/Supabase instances through a websocket"
No description
2 Replies
Servesh
Servesh5mo ago
could u share your drizzle config? also try to log the values of the env variables to see if they're set correctly..
Saifur
Saifur5mo ago
import { defineConfig } from 'drizzle-kit'

import { env } from '~/env'

console.log(env.DATABASE_URL)

export default defineConfig({
schema: './src/lib/db/schema.ts',
out: './src/lib/db/migrations',
dialect: 'postgresql',
dbCredentials: {
url: env.DATABASE_URL,
},
})
import { defineConfig } from 'drizzle-kit'

import { env } from '~/env'

console.log(env.DATABASE_URL)

export default defineConfig({
schema: './src/lib/db/schema.ts',
out: './src/lib/db/migrations',
dialect: 'postgresql',
dbCredentials: {
url: env.DATABASE_URL,
},
})
and yes, I've tried logging the env var, it works fine, I'm also using the latest version I've tried to test this with a hono, bun server, it it worked in some arieas, The "drizzle-kit push" and "drizzle-kit studio" didn't work, then I set up maigration for neon db, then It worked. and yes db queries are working in hono server, but I'm having complete brekdown on my next.js app
Want results from more Discord servers?
Add your server