Getaddrinfo ENOTFOUND when connecting to internal Redis

I have pasted in the internal redis URL into my app’s env configuration under REDIS_URL as the docs mention.

When the app starts in Render, I am getting the following error and then the app refuses to start:

Jul 18 04:45:31 PM  Error: Redis connection to red-c9erv7gnlki5356k75v0:6379 failed - getaddrinfo ENOTFOUND red-c9erv7gnlki5356k75v0
Jul 18 04:45:31 PM      at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:60:26) {
Jul 18 04:45:31 PM    errno: 'ENOTFOUND',
Jul 18 04:45:31 PM    code: 'ENOTFOUND',
Jul 18 04:45:31 PM    syscall: 'getaddrinfo',
Jul 18 04:45:31 PM    hostname: 'red-c9erv7gnlki5356k75v0'
Jul 18 04:45:31 PM  }

I am connecting to other redis instances fine, it is this internal link causing issues.

Connecting via the node-redis package.

The first thing to definitely check here is that your app and your Redis service has been deployed to the same region - we don’t yet support cross-regional communication

John B

Thanks, that was it @John_B - I am coming across the same issue as this thread now though: Redis connection getting fall

Working in development, setting my REDIS_URL to the Render external redis URL, the app works perfect.

Deploying to render, my REDIS_URL set to either the external URL, or the internal Render URL, I get the following error:

Jul 19 02:25:18 PM  Unhandled Rejection at: Promise {
Jul 19 02:25:18 PM    <rejected> Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED 127.0.0.1:6379
Jul 19 02:25:18 PM        at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1129:14) {
Jul 19 02:25:18 PM      errno: 'ECONNREFUSED',
Jul 19 02:25:18 PM      code: 'ECONNREFUSED',
Jul 19 02:25:18 PM      syscall: 'connect',
Jul 19 02:25:18 PM      address: '127.0.0.1',
Jul 19 02:25:18 PM      port: 6379
Jul 19 02:25:18 PM    }

Code is the exact same as development. Any ideas?

This going to be an application issue. Typically Redis clients fall back to using localhost Redis if they aren’t configured or a variable they expect isn’t found

Regards,

John B