I am trying to review the Upstash Redis solution provided by fly, but having some difficulties and also some questions. Maybe someone can help out with more information.
The first doubt I have is if the database provided here is fully compatible with Redis, meaning TCP persistent connection and Redis commands, or if it’s a serverless flavor where only the REST API can be used?
I am able to connect to the database using the fly redis connect ... CLI command, but through my application it doesn’t seem to work.
I can’t argue the database isn’t available to the app, because running the following command tells me that the address can be resolved
I’ve created a free database on Upstash directly and I’ve managed to connect to that one; actually I created two, one with TLS and another without, both cases I can connect. So… maybe the application isn’t “seeing” the database after all or… something I’m not seeing.
I’ve double checked the regions and both the application and database are in the same region (ams).
I needed to add ?family=6 to my connection string to get the connection working to my upstash Redis DB from Fly as it uses an IPv6 connection. Similar to comments here: Connecting to Redis App
@goncalo-oliveira Did you resolve this? In most cases, this can happen because of lacking to set the IPv6 family on Node clients, related to what @Stephen mentioned here.
I needed to add ?family=6 to my connection string to get the connection working to my upstash Redis DB from Fly as it uses an IPv6 connection
Thanks for the reply @Stephen and apologies for the late reply. Though, that didn’t work. Those similar comments refer to Node clients, which is not the case. I’m using .NET and StackExchange’s redis client, which fully supports IPv6.
@jsierles thanks for the reply. I haven’t, no. Can only connect to an Upstash Redis created on their platform directly.
No SSL enabled since the connection is already encrypted over the Fly private network. And yes, Upstash Redis uses the default port. You must be running your app in the same organization as the Redis instance.
@jsierles thanks for the reply. Though, I have no idea what might be the issue then. I’ve tried all sorts of combinations (with and without SSL) and no luck. As I said before, both are in the ams region.
$ fly redis list
map[eviction:true]
NAME ORG PLAN EVICTION PRIMARY REGION
green-sky-9960 personal Free Enabled ams
$ fly apps list
NAME OWNER STATUS PLATFORM
fly-builder-polished-surf-206 personal suspended machines
holy-sun-7268 personal running nomad
$ fly regions list -a holy-sun-7268
Region Pool:
ams
Backup Region:
$ fly dig fly-green-sky-9960.upstash.io
;; opcode: QUERY, status: NOERROR, id: 45899
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; QUESTION SECTION:
;fly-green-sky-9960.upstash.io. IN AAAA
;; ANSWER SECTION:
fly-green-sky-9960.upstash.io. 15 IN AAAA fdaa:1:2026:0:1::2
;; ADDITIONAL SECTION:
;; OPT PSEUDOSECTION:
; EDNS: version 0; flags: ; udp: 4096
The connection error is the following, just for clarification
Ok, this is sorted. The client does support IPv6 and a bug was fixed and released in December.
Because I was using the client through a microsoft caching package (Microsoft.Extensions.Caching.StackExchangeRedis) I was loading an older version without that fix, so… not working. That was addressed here.
Updating the client package did the trick. All sorted!
Thanks to all and hopefully this can help someone else.
You’re using StackExchange to connect as well? What’s the version of the package you’re using? Or are you using the distributed caching packages (Microsoft.Extensions.Caching.StackExchangeRedis)?
You’re not using the latest version of the redis client package. Shouldn’t matter, since the IPv6 bug was sorted out with 2.6.62, but I guess it wouldn’t hurt to update.
From your redis URL, the configuration string should look something like this (just replace with your redis IPv6)
That should work inside the deployed application. At least it worked for me. If not, maybe confirm the redis instance is in the same region as the app.