Nextjs Turbopack: NeonDbError: Error connecting to database: fetch failed
getting this error sporadically on my local, it'll spam a handful of them at a time.
only seems to happen when using turbopack, not with webpack. had a quick search in the server for anything to do with turbo to no avail.
assuming this is a turbopack compatibility thing
node: 20.11.0
next: 14.2.2
drizzle: ^0.30.9
@neondatabase/serverless: ^0.9.1
5 Replies
ambitious-aqua•2y ago
Sounds like it could be Turbopack, but we've also seen some potential issues with Node.js v20. If you use Node.js 18 does it happen too?
afraid-scarletOP•2y ago
it doesn't seem to, no.
seems like you know about node 20 issues so nothing further from me then, all good 👍
ambitious-aqua•2y ago
Interesting, this does add weight to the Node.js 20 theory
afraid-scarletOP•2y ago
i do remember seeing something to do with undici changes in 20
not sure if that would have anything to do with it
weirdly enough i do get sporadic "error connecting to database: fetch failed" errors in prod (vercel node 20) but i only have 2 in the last day, so its probably just http doing its thing
whereas in dev/local it'll happen every other page load
ambitious-aqua•2y ago
This is my hunch TBH. Something in the undici implementation is potentially causing issues.
(Not suggesting that undici is broken, it could be that it's doing something correctly and old fetch or the serverless driver was reliant on that "broken" behaviour)
Hmm, that's odd. I wonder if it's something with hotreload breaking connections