Can't connect to redis app via private network

I have two apps running on fly:

  • A redis app that I created following this guide
  • And a node app that I created using a custom Dockerfile

They are both part of the same organization: “personal”.

The node app doesn’t seem to be able to connect to the redis one. This is the error I get

errno: -3008,
2022-06-21T11:56:20Z   [info]  code: 'ENOTFOUND',
2022-06-21T11:56:20Z   [info]  syscall: 'getaddrinfo',
2022-06-21T11:56:20Z   [info]  hostname: 'redis-staging.internal'
2022-06-21T11:56:20Z   [info]}
2022-06-21T11:57:29Z   [info]Error: getaddrinfo ENOTFOUND redis-staging.internal
2022-06-21T11:57:29Z   [info]    at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:71:26)

I read through a few other questions that people have asked and I also changed the family of my [node redis client](

    return redis.createClient({
      url: process.env.REDIS_URL,
      socket: {
        family: 6

This is the fly.toml file used to generate the Redis app

app = "redis-staging"
kill_signal = "SIGINT"
kill_timeout = 5
processes = []

  image = "flyio/redis:6.2.6"


  allowed_public_ports = []
  auto_rollback = true


  destination = "/data"
  source = "redis_server"

This is the Dockerfile I generated the node app with

FROM node:16.13.0-alpine3.11


COPY package.json yarn.lock ./

RUN yarn install --pure-lockfile

COPY . .


RUN yarn run build

CMD ["yarn", "start"]

I set the REDIS_URL secret using the command flyctl secrets set REDIS_URL=redis://default:myverysecretpassword@redis-staging.internal:6379 -a my-node-app

What could be going wrong?

I think you need family: 'IPv6' in your Redis client options, right after url.

Thanks @kurt. That is what I did at first, however, then I checked the GH of the redis clinet I’m using and it showed I should set it in the “socket” object

Oh that looks like it changed between versions? Are you on v4?

If fly dig redis-staging.internal -a redis-staging shows IPs, it’s most likely the driver not looking up IPv6.

The version of the redis npm package I’m using is 3.0.2. So as you spotted, I reverted the code back to what you said

    return redis.createClient({
      url: process.env.REDIS_URL,
      family: 'IPv6'

This is the output from the fly dig command

;; opcode: QUERY, status: NOERROR, id: 43467
;; flags: qr rd; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;redis-staging.internal.	IN	 AAAA

redis-staging.internal.	5	IN	AAAA	fdaa:0:6f4f:a7b:23c5:1:286c:2