cant connect to upstash redis from local machine

It works fine if my fly app connects to redis, but I get this error on my local machine:

[ioredis] Unhandled error event: Error: getaddrinfo ENOTFOUND fly-autumn-sun-6838.upstash.io
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:107:26)

I am using ioredis in node.js v19 environment on my local machine to test things out.

I have read some posts and it looks like above node v18, I need to set the connection to IPv6, so I did set the family: 6:

import IORedis from 'ioredis'
const redis = new IORedis("redis://default:secret@fly-autumn-sun-6838.upstash.io:6379", { family: 6 })

But for all cases it generates the same error. maybe I need to whitelist my local IP somewhere? because it works for other redis connections(redis cloud). But I dont see anything about this in the fly dashboard

Redis is only available from within the fly network right now.
See Redis by Upstash · Fly Docs

ah ok, it wasnt very clear from the docs. So I guess, for dev purpose, I should just run my own redis server

Using the fly proxy command, you can easily proxy connections from localhost to your organization’s private network.
For instance, you can proxy to your Upstash database with fly proxy 6000 <db-hostname>.upstash.io --org <org> where db-hostname. In your case that would be fly-autumn-sun-6838

Thanks, and it would be great to have a link to fly proxy command and possibly with an example in the redis traffic routing docs!

2 Likes

That’s a great idea, it’s noted.

what does the 6000 note? i am still running into a similar issue where even though the proxy is running i have no success connecting to my upstash redis locally, which makes development kind of a pain

It is the port number… Port 6000 on localhost gets tunneled through to port 6000 on <db-hostname>.upstash.io.