Redis Upstash Unable to Connect to Nodejs App

Hi All,

I tried to setup my nodejs app on fly,io and seems okay. However, the node instance is unable to connect to the managed redis. The node app itself runs on port: 4000 and redis:6379. I’ve tried a few things already.

Any thoughts on how to resolve this?


// connection

const subscriber = new Redis(process.env.REDIS_URL, {
  family: 6,
  retry_strategy: (options) => Math.min(options.attempt * 100, 3000),

const redisInstance = subscriber.duplicate();
const publisher = new Redis(process.env.REDIS_URL, { family: 6 });

// error
2023-02-20T19:37:58Z   [info][20/02/2023 19:37:58.054] [ERROR]  Error: getaddrinfo ENOTFOUND
2023-02-20T19:37:58Z   [info]    at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:109:26)
2023-02-20T19:37:58Z   [info]    at GetAddrInfoReqWrap.callbackTrampoline (node:internal/async_hooks:130:17)

Which Redis library are you using? Each client has its quirks about specifying the IPv6 address family correctly.

Otherwise, does fly redis connect work for you? Also, what’s the base image you’re using in your Dockerfile? alpine can sometimes have issues with DNS resolution. On your VM, try host to see what address you get.

Thanks @jsierles

I’m using ioredis hence why I’m passing the ipv6 address family like so:
new Redis(process.env.REDIS_URL, { family: 6 })

I could fly redis connect from my host machine to the redis instance okay.

For the image, I’m using node:16.18.1 image.

host has IPv6 address fdaa:0:a8c2:0:1::2

Thanks. Is this still happening? It would be great if you could setup a public test repo we could clone to reproduce the issue.