Issue with neondatabase/wsproxy for local development.
Hi, I'm running into this error using the neon http driver with the docker image. I followed this guide: https://gal.hagever.com/posts/running-vercel-postgres-locally
NeonDbError: Error connecting to database: Failed to parse URL from https://api.0.0.0/sql
Here is the code
9 Replies
eastern-cyanOP•2y ago
The Pool way works perfectly
I think the error comes from the @neondatabase/serverless, because if i change the host to postgres://postgres:postgres@1.2.3.4:5433/postgres, then the error becomes NeonDbError: Error connecting to database: Failed to parse URL from https://api.2.3.4/sql
blank-aquamarine•2y ago
I believe "https://api.0.0.0/sql" isn't a valid URL. Is that the real value you're using?
This throws an error for me
The Pool way works perfectlyThis is interesting. That does suggest something odd with the hostname parsing for HTTP queries. Do you mind sharing your hostname? You can DM me if you prefer
eastern-cyanOP•2y ago
Oh I'm not using Neon Cloud for this test. https://gal.hagever.com/posts/running-vercel-postgres-locally
Running Vercel Postgres Locally
The setup I use for local work with Vercel Postgres or Neon database
eastern-cyanOP•2y ago
It works great with the neon connection string, i'm trying to make it run locally to avoid using a branch for development
I'm using this docker compose file
blank-aquamarine•2y ago
Sorry for the delay, I took a quick look at this code and ran it locally. Then it hit me 🙂 You're running the ws-proxy, that's why pool works. Pool works over websockets. You need the HTTP proxy.
George has shared some details here: https://github.com/neondatabase/serverless/issues/33#issuecomment-1634853042
GitHub
Any way to connect from localhost? · Issue #33 · neondatabase/serve...
I would like to use an offline local instance of postgress while developing on my computer, I'm trying something like this: import { neon, neonConfig } from '@neondatabase/serverless' i...
blank-aquamarine•2y ago
Someone has commented on that issue and shared a container with the setup. I will look into this sometime during the week.
eastern-cyanOP•2y ago
Thanks for the help, on that issue is this repo https://github.com/TimoWilhelm/local-neon-http-proxy that seems to solve the issue
GitHub
GitHub - TimoWilhelm/local-neon-http-proxy: Connect to a local Post...
Connect to a local PostgreSQL database using the neon http proxy - TimoWilhelm/local-neon-http-proxy
eastern-cyanOP•2y ago
i will give it a try
stormy-gold•2y ago
We're going to be working on a docker build for postgres + http support soon, but it got bumped for higher priority things atm