Unable to connect node app to managed Redis

I’m playing around with porting a Node.js app that I’ve had running on Heroku for a bunch of years over to fly.io. One of the dependencies is Redis, and I’m trying to use the managed Redis from upstash that’s in public beta. I grabbed the Private URL from fly redis status ... and then set it as a secret which is pulled into my app as an env var and passed into the node-redis client creation. I get the following error when the client tries to connect:

Error: getaddrinfo ENOTFOUND fly-pigskin-redis.upstash.io

I printed out the Redis client config options that get passed into the client, and the URL it’s using looks right. I saw on a different post about connecting to a non-upstash Redis instance on fly that it might be an ipv6 thing, and to try the family: 6 config option during redis client creation. I tried that also. The docs are here.

I also changed my Dockerfile command to ping the same hostname and see if it can resolve, and it does. fly redis connect also works fine. Any ideas what I might be missing?

was it solved?

This was solved after I upgraded to the latest version of node-redis and connect-redis and followed the configuration options there.

1 Like

I ran into a similar situation as well. I was running @fastify/redis which ran ioredis under the hood. It was encountering the same error when deploying on fly. Setting the family option to 6 (for ipv6( seems to have fixed things for me, and it also works for local development. Thanks for the pointer!