I am running a go app on Fly. Whenever my machine tries to connect to upstash redis after being idle, the connection times out and throws an error. However, subsequent requests (refreshing the page) works. This is the error:
Hey there! You should be using just redis:// as Upstash doesn’t run with TLS inside Fly.io (all traffic is already encrypted). And you can skip the TLS config.
Were you seeing timeouts using redis:// instead of rediss://? Also, in which region are running your app and Redis?
Sorry, I misunderstood you. You’ll have a much better experience using the Fly-based Upstash Redis. Are you able to switch to it?
If not, you’re doing the right thing. However, you are crossing network boundaries. If your app is hosted in iad, you should see decent performance. From elsewhere, there are fewer guarantees since there is physical distance between your app and Redis.
I also think it might be a go-redis issue, because I see the same problem when using non-upstash redis. I just can’t figure out the right golang config to automatically reconnect and retry when there is an idle timeout.
Good question. It is confusing. At some point I created a fly Upstash instance, months ago. However, when I go back to the Upstash website and log in, it doesn’t show me any of my old Fly DBs. I honestly have no idea how to access them. I’ve tried logging in via Google and GitHub but I still just get “regular” Upstash accounts.
So that told me that the best way to use Upstash is via a regular account rather than a fly integration. Because the fly integration was less an integration with an existing account, but actually a whole new thing. Like, imagine you have a PayPal account vs a “PayPal account that only works with Shopify”. Its confusing.
In terms of the ideal scenario:
Regular Upstash should not break just because it is running on fly and you have different routing.
There should be exactly 1 way to connect and exactly 1 connection string
In Upstash, there is a button to click to choose where to deploy: AWS vs gcp. There should just be another option for Fly on that screen. Whatever connection string it spits out should work both on localhost and Fly.