Unable to connect to Redis Upstash

Hi All -

I’ve just setup a nodejs app on fly.io via a Dockerfile. However I’m having trouble connecting to the redis instance from within the app. The error messages at runtime:

2023-02-19T22:47:36Z   [info][19/02/2023 22:47:36.751] [ERROR]  Error: getaddrinfo ENOTFOUND fly-fc-redis.upstash.io
2023-02-19T22:47:36Z   [info]    at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:109:26)
2023-02-19T22:47:36Z   [info]    at GetAddrInfoReqWrap.callbackTrampoline (node:internal/async_hooks:130:17)
2023-02-19T22:47:37Z   [info]Starting clean up.

Any idea what I might need to do?

Node app running on port: 4000 and redis on 6379.

1 Like

Thought I’d provide more context:

REDIS_URL=redis://some_user:some_pass@fly-fc-redis.upstash.io:6379/

// 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 fly-fc-redis.upstash.io
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)

I’m currently getting the same. Unsure how to resolve… None of the Redis instances I create via the Fly CLI have resolvable hostnames.

How are you testing whether the addresses are resolvable? That’s usually an issue with IPv6 support in your client.

Ah yeah indeed that would explain why it doesn’t work locally, but I get the DNS issue as @bwoodlt posted on my deployed instance. Maybe a configuration setup with my image or node.js, though I don’t think I’m doing anything weird with it.

Actually maybe it’s something to do with this: Unhandled error event: Error: getaddrinfo ENOTFOUND - AWS ElasticCache · Issue #1576 · redis/ioredis · GitHub

I’ll have a look around, thanks for the heads up

1 Like

Hey @ahtcx I’m having the same issue. Were you able to find a solution?

Adding ?family=6 to the connection string fixed it.