Upstash with Fly and remix

Hello, I’m using React Remix with fly.io configuration,

I create a redis database copied the Redis URL from the fly cli, and also tries the upstash console by I keep getting
Error: connect ECONNREFUSED ::1:6379 at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1494:16) {
errno: -61,
code: ‘ECONNREFUSED’,
syscall: ‘connect’,
address: ‘::1’,
port: 6379
},

I can connect to redis from my cli, but not through my app on localhost, I suggestion or things to try, I’m all out of ideas?

@Nadim

Did you run

fly redis connect

?

You can also try the following if the above doesn’t work for you:

To connect your local application to the Redis database on Fly.io, you can use the flyctl proxy command:

  1. Open your Redis Fly App’s local directory:
cd your-redis-app-directory
  1. Run the flyctl proxy for port 6379 or whichever REDIS_PORT you have configured:
fly proxy 6379
  1. Update your React Remix application’s configuration to use the correct Redis URL and port provided by Fly.io or Upstash. Make sure the REDIS_PORT in your configuration matches the port used in flyctl proxy.

After making these changes, your local React Remix application should be able to connect to the Redis database on Fly.io. If you still encounter issues, please double-check your application’s configuration and ensure that it’s using the correct Redis URL and port.

Thank you jacob for your help,

okay! I have added the port 8080 to my fly.toml file, and the app now listens on that port, I have also tried fly redis connect my-redis-db and it works aswell. I can type commands and see usage spike in upstash. BUT I still can’t connect to it via node redis.

What I found:
fly cli gives my this url for redis:
"redis://default:password@fly-app-redis1.upstash.io"
while upstash gives me:
"redis://default:password@fly-app-redis1.upstash.io:37005"
which one do I choose? I tried both and I end up with the screen shot below.

some things I’m considering,
Do I need a dedicated v4 IP?

I have given up on trying to connect fly to my local machine via wireGaurd, as that is another problem to solve later, now I just run a different redis db locally and see if I can connect my remix app to redis on the cloud.

If someone can also direct my to how fly.io does networking, as nothing is able to connect to my fly machine unless I allow all ips to access my db (0.0.0.0), that would be helpful?

Thanks a lot!

here is also an image of my Redis connection via the CLI

You may need to pass use family: 6 in your Redis config, since your app is connecting to an IPv6 address.

Thank you! got it working ended up being a connection issue in my prod env. But because I couldn’t connect to it from local, my mind went to it being a connection issue. Any idea of what latency I should expect from redis upstahs running on fly for a simple redis.get(object) and then running json.stringify?

You can get a general idea of latency from these charts provided by Upstash: Upstash Latency Benchmark

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.