Gotcha with redis and IPv6

Just a heads up for those who might run into the same issue:

I have an environment with a redis container named redis. In another container in the same environment, I had a nodejs server trying to connect to the redis server via the ioredis library. Basically I had a file like

import { Redis } from "ioredis";
export const redis = new Redis("redis://redis:6379");

On server start, I was seeing a stream of errors along the lines of

[ioredis] Unhandled error event: Error: getaddrinfo ENOTFOUND redis
at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:109:26)
at GetAddrInfoReqWrap.callbackTrampoline (node:internal/async_hooks:130:17)
[ioredis] Unhandled error event: Error: getaddrinfo ENOTFOUND redis
at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:109:26)
at GetAddrInfoReqWrap.callbackTrampoline (node:internal/async_hooks:130:17)
[ioredis] Unhandled error event: Error: getaddrinfo ENOTFOUND redis
at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:109:26)
at GetAddrInfoReqWrap.callbackTrampoline (node:internal/async_hooks:130:17)

This was very strange as the two containers were on the same network and redis should have been (and turns out, was) a valid hostname. Furthermore I was able to run via SSH on the node server instance:

# redis-cli -h redis PING
PONG

So the hostname was valid. What was going on?

After some discussion with the cycle team (thanks!!), it turns out the issue is that the internal networking within the environment is all done via IPv6, and by default, the ioredis client doesn't allow DNS resolution into IPv6. For whatever reason ๐Ÿคท๐Ÿปโ€โ™‚๏ธ. But the fix was very simple. This works:

import { Redis } from "ioredis";
export const redis = new Redis({ host: "redis", family: 6 });

Explicitly tell the client to use IPv6, and it will.

Perhaps this will come in handy for someone later ๐Ÿ˜„ again, thanks to the cycle team for finding the solution to this!

Opened by Allen Nelsonโ€ข...
3 replies

    Thanks for that details explanation Allen! Super helpful ๐Ÿ˜Š

    Opened by Christopher Aubuchonโ€ข...

    Thanks Allen. Is it me, or does it seem like the Internet needs to get together and build an IPv6 compatibility site like the ECMAScript table (https://compat-table.github.io/compat-table/es6/) that tracks the level of IPv6 support for apps and links to relevant documentation for apps like Redis that have partial/qualified support? The lack of clarity in this area seems to drive a lot of the FUD that slows down the v4 -> v6 conversion.

    Opened by Casey Dementโ€ข...

    I would agree on that Casey. Sometimes you're searching for specific threads just to understand who is supporting IPv6 and what type of secret config has been hidden away to get it to work out of the box.

    Opened by Jeff Klinkโ€ข...

Join the conversation

Sign in with your Cycle account to reply to this thread.

v2026.06.06.01 ยท ยฉ 2026 Petrichor Holdings, Inc.