Static IP guide
Connecting to MySQL with a static IP from a Node app on Vercel
MySQL hosts that enforce allowlists — RDS, Cloud SQL, Azure Database for MySQL — cannot admit Vercel's rotating egress IPs. mysql2 accepts a custom stream, so each function invocation opens a SOCKS connection through Fixie and the database sees a stable address instead.
Recommended setup
Use Fixie Vercel integration for MySQL or MariaDB connections from a dynamic hosting platform. Store the proxy value in FIXIE_SOCKS_HOST, then configure Node.js to route outbound traffic through Fixie before connecting to MySQL.
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 MySQL through FIXIE_SOCKS_HOST
Good to know
- The pooled example suits long-lived servers; in a function, create a connection per invocation and end it before returning.
- Keep TLS enabled toward the database; the SOCKS tunnel wraps the encrypted session without terminating it.
Allowlist and test the static IPs
- Open the Fixie dashboard and copy the outbound IP addresses for this proxy.
- Add both IPs to the MySQL 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 MySQL with a static IP from a Node app on Heroku
- Connecting to Postgres with a static IP from a Node app on Vercel
- Connecting to MongoDB with a static IP from a Node app on Vercel
- Connecting to Amazon Redshift with a static IP from a Node app on Vercel
Related docs
- Node.js implementation examples
- Vercel setup documentation
- MySQL connection guide
- Fixie-Wrench for TCP forwarding
Is this guide useful?