Error: Error connecting to database: fetch failed (next.js)
At first I thought the problem is with drizzle but the sql function causes the same error as drizzle, I'm using the @neondatabase/serverless package from my next.js app, I've tried both http and websocket connection but nothing worked.

3 Replies
national-gold•2y ago
Hey! Sorry to hear that you're running into an issue. Just to double check, are you able to run queries from psql/the Neon console?
Another question: is the connection string being imported from the environment variable correctly? Are you able to log it?
adverse-sapphireOP•2y ago
ok, just checked, I can run queries in the neon console, and the env var is setup correctly, It was woring fine maybe few days ago, and suddenly it just stop working. I've tested this with bun hono server where drizzle implementation works fine (some command did't work ex: "drizzle-kit push" and "drizzle-kit studio"), but I'm having problem with next.js, it seems nothing is working here.
is it somthing to do with next.js? I'm not sure
fair-rose•15mo ago
can you share the code you're using?