Static IP guide
Connecting to Postgres with a static IP from a Node app on Vercel
Connecting Vercel functions to Postgres behind an IP allowlist — RDS, Supabase with network restrictions, a corporate database — fails by default because function egress IPs are unpredictable. Fixie Socks solves it in code: a socksjs stream handed to the pg client, created inside the invocation, presenting a fixed IP to the database.
Recommended setup
Use Fixie Vercel integration for Postgres connections to a database that only accepts traffic from approved IP addresses. Store the proxy value in FIXIE_SOCKS_HOST, then configure Node.js to route outbound traffic through Fixie before connecting to Postgres.
Set up Fixie on Vercel
Add the Fixie Vercel integration, create a proxy in the Fixie dashboard, and connect it to the Vercel project and environment. The integration can create FIXIE_SOCKS_HOST in Vercel Environment Variables for the connected project.
Pull Vercel environment variables locally
Implementation
The example below shows the core application-side change. Keep credentials in environment variables and avoid committing proxy, database, or API secrets.
Connect to Postgres through FIXIE_SOCKS_HOST
Good to know
- Open and close the client within the invocation — a connection cached across invocations can go stale between requests and fail confusingly.
- This must run on the Node.js runtime; the Edge runtime has no TCP sockets.
- Security-group rules need both Fixie IPs on port
5432.
Allowlist and test the static IPs
- Open the Fixie dashboard and copy the outbound IP addresses for this proxy.
- Add both IPs to the Postgres firewall or security group.
- Deploy the updated Node.js app on Vercel.
- Run a small connection test before sending production traffic.
Related guides
- Making API requests with a static IP from a Node app on Vercel
- Connecting to Postgres with a static IP from a Node app on Heroku
- Connecting to MySQL with a static IP from a Node app on Vercel
- Connecting to Postgres with a static IP from a Node app on Render
- Connecting to MongoDB with a static IP from a Node app on Vercel
- Connecting to Postgres with a static IP from a Node app on Fly.io
Related docs
- Node.js implementation examples
- Vercel setup documentation
- Postgres connection guide
- Fixie-Wrench for TCP forwarding
Is this guide useful?