Unable to Connect Render-Deployed Node.js Backend to Supabase Postgres Database

I am trying to deploy my Node.js Express backend on Render, and my database (postgres) is hosted on Supabase. However, the backend is not able to establish a connection with the database.
What I’ve Tried

  1. Verified the Supabase connection string is correct and works locally.
  2. Ensured that the database credentials (host, port, user, password, and database name) are correctly added to Render’s environment variables.
  3. Allowed all incoming IPs in the Supabase database network settings.

Node.js v22.12.0

Jan 17 01:45:34 PM

Jan 17 01:45:34 PM}

Jan 17 01:45:34 PM }

Jan 17 01:45:34 PM port: 5432

Jan 17 01:45:34 PM address: ‘2406:da1a:6b0:f603:50c4:c6e8:e1f9:1d4d’,

Jan 17 01:45:34 PM syscall: ‘connect’,

Jan 17 01:45:34 PM code: ‘ENETUNREACH’,

Jan 17 01:45:34 PM errno: -101,

Jan 17 01:45:34 PM at GetAddrInfoReqWrap.onlookupall [as oncomplete] (node:dns:132:8) {

Jan 17 01:45:34 PM at GetAddrInfoReqWrap.emitLookup [as callback] (node:net:1501:9)

Jan 17 01:45:34 PM at defaultTriggerAsyncIdScope (node:internal/async_hooks:464:18)

Jan 17 01:45:34 PM at internalConnect (node:net:1104:16)

Jan 17 01:45:34 PM original: Error: connect ENETUNREACH 2406:da1a:6b0:f603:50c4:c6e8:e1f9:1d4d:5432 - Local (:::0)

Jan 17 01:45:34 PM },

Jan 17 01:45:34 PM port: 5432

Jan 17 01:45:34 PM address: ‘2406:da1a:6b0:f603:50c4:c6e8:e1f9:1d4d’,

Jan 17 01:45:34 PM syscall: ‘connect’,

Jan 17 01:45:34 PM code: ‘ENETUNREACH’,

Jan 17 01:45:34 PM errno: -101,

Jan 17 01:45:34 PM at GetAddrInfoReqWrap.onlookupall [as oncomplete] (node:dns:132:8) {

Jan 17 01:45:34 PM at GetAddrInfoReqWrap.emitLookup [as callback] (node:net:1501:9)

Jan 17 01:45:34 PM at defaultTriggerAsyncIdScope (node:internal/async_hooks:464:18)

Jan 17 01:45:34 PM at internalConnect (node:net:1104:16)

Jan 17 01:45:34 PM parent: Error: connect ENETUNREACH 2406:da1a:6b0:f603:50c4:c6e8:e1f9:1d4d:5432 - Local (:::0)

Jan 17 01:45:34 PM at process.processTicksAndRejections (node:internal/process/task_queues:90:21) {

Jan 17 01:45:34 PM at emitErrorCloseNT (node:internal/streams/destroy:129:3)

Jan 17 01:45:34 PM at emitErrorNT (node:internal/streams/destroy:170:8)

Jan 17 01:45:34 PM at Socket.emit (node:events:524:28)

Jan 17 01:45:34 PM at Socket.reportStreamError (/opt/render/project/src/node_modules/pg/lib/connection.js:57:12)

Jan 17 01:45:34 PM at Connection.emit (node:events:524:28)

Jan 17 01:45:34 PM at Client._handleErrorEvent (/opt/render/project/src/node_modules/pg/lib/client.js:336:19)

Jan 17 01:45:34 PM at Client._handleErrorWhileConnecting (/opt/render/project/src/node_modules/pg/lib/client.js:326:19)

Jan 17 01:45:34 PM at Client._connectionCallback (/opt/render/project/src/node_modules/sequelize/lib/dialects/postgres/connection-manager.js:145:24)

Jan 17 01:45:34 PMConnectionError [SequelizeConnectionError]: connect ENETUNREACH 2406:da1a:6b0:f603:50c4:c6e8:e1f9:1d4d:5432 - Local (:::0)

Jan 17 01:45:34 PM

Jan 17 01:45:34 PM ^

Jan 17 01:45:34 PM triggerUncaughtException(err, true /* fromPromise */);

Jan 17 01:45:34 PMnode:internal/process/promises:394

Jan 17 01:45:34 PM}

Jan 17 01:45:34 PM }

Hi there,
This is related to Supabase’s opting to default to IPv6, as detailed in their announcement here.

You need to be using their “Supavisor database proxy” which has IPv4 enabled which will work for services running on us,