Cannot connect to Neon

I have a Remix app that I’m trying to deploy on The deploy works, but I can’t connect to my database, which is on Neon. I get:

NeonDbError: Error connecting to database: request to failed, reason: socket hang up

I can connect via my current deploy config (Cloudflare Pages) and on local. Pretty sure my DATABASE_URL secret is configured correctly. I’m stumped. Anyone got any ideas for me?


Are those errors occasional (like random socket hang ups), or has it never connected?

Which client are you using to connect to it? It looks like there a variety of JS/TS options and some have notes e.g for how they need SSL:

If it is to do with SSL Ii wonder if this section would help:

Of course it’s possibly a random network thing between Fly and AWS (I assume). You could perhaps SSH in to the Fly machine and do a traceroute to that hostname and see if that reveals anything too.

I figured it out. I was migrating from a serverless environment and using the neon-serverless driver. Needed to switch to something like postgres.js. I tried deploying on Railway as well and got the same error, which tipped me off.