Drizzle with Next 13.4.2 & Vercel Postgres Timeout

Hi all. I'm trying out NextJS server actions and Drizzle for the first time. I have it hooked up to Vercel Postgres as the docs describe and all seems to work. However, after 5 or 6 reads or writes, it seems like the db connection stalls and the serverless / edge function eventually timesout until restarted. I've enabled drizzle logs and I see the query being fired but then nothing, it stops at that point. I can't work out what I'm doing wrong and appreciate any suggestions in the right direction. I wonder if it's some sort of pool issue, but then I'm using the direct vercel/postgres library and suggested drizzle config. Repo for example here: https://github.com/Xexr/next_test Deployment so you can see it fail here: https://next-drizzle-test.vercel.app/ (just refresh the page and eventually you'll see it timeout)
GitHub
GitHub - Xexr/next_test
Contribute to Xexr/next_test development by creating an account on GitHub.
4 Replies
xexr.
xexr.14mo ago
Having tried a few more things, I think this issue specifically occurs when the component is set to an edge function (via export const runtime = 'edge';). But it should still work in that setup too shouldn't it? For anyone who finds this. I believe the issue is with the drizzle postgres plugin or the vercel storage driver. I've switched to planetscale mysql, using drizzle and next edge functions and the issue doesn't repeat.
AlcaponeYou
AlcaponeYou14mo ago
I would not recommend Vercel's storage solution at all. It's very expensive and unstable. If you need the postgres db, just go to NEON yourself and create an account, it takes literally 1 minute. The dashboard and query editor on NEON is superior than vercel too
pdina
pdina13mo ago
@alcaponeyou this may be a dumb question, but if the application (frontend and backend) is running on Vercel servers, and the database is on Neon, wouldn't this introduce latency?
AlcaponeYou
AlcaponeYou13mo ago
Not anymore than using vercel. They too use neon under the hood
Want results from more Discord servers?
Add your server
More Posts