could not send HTTP request to instance: connection error: timed out

Hello, I have developed my telegram bot with a postrges database and using the binance websocket.
I get messages with required rates in the bot at a certain command, but when I execute it often the bot does not respond and in the logs I see the following error:

could not send HTTP request to instance: connection error: timed out

If I restart the instance, everything works for a few hours and then the bot stops responding to me again.

Please help me, because I don’t understand what’s wrong.

Thank you in advance!

im facing the same thing as well. After an hour or so, the server erros out like this, not sure what happening, dont know if this is an uptash redis problem either.

Will be migrating from uptash to somthing else now, lets see if the problem occurs.

just migrated from uptash, the problem got resolved.

Where did you migrate to?

managed redis with digital ocean

@freeezefive I didn’t see anything related with Upstash in your first comment. Do you use Upstash? If yes which client do you use? Where did you create Upstash Redis? ( flyctl or upstash console )
Can you give a bit more details or how to reproduce this issue?

When the Fly proxy sends requests to your app, it will wait 60 seconds for a response. After that, you’ll see this error. Your app could be timing out for a number of reasons, such as slow database requests, or timeouts to other services that your app connects to.

If your application isn’t logging anything about these timeouts, check to make sure the clients for your target services (Postgres, etc) are configure to log when connection errors occur.

This is my problem, but I don’t know how to control the log settings for Postgres, etc. Could you point me toward some info on this?

You’d want your application logs, not those from Postgres. So depending on your runtime and client library, you’d want to check how the library deals with errors.

1 Like

@jsierles but how did all my problem go away after moving away from uptash redis?
I was using ioredis, with family 6 and nothing else added (surely the url was added).

Had to spend a day or two to even realize this was an uptash redis issue. Soon after migrating to an external redis, all my problems magically went away.

@pollux We’re talking about two different issues here. In your case, it may be that Redis timeouts were indirectly causing your app HTTP requests to time out. In the case of @freeezefive, Redis was not in play.

There’s another thread discussing what may be related to the problem you’re seeing: Upstash Redis and "could not send HTTP request to instance: connection error: timed out" logs - #4 by jsierles.

ohh okay hmm

A way to be sure would be to connect directly to Redis from your VM, using redis-cli. If that doesn’t work, then there’s something wrong. Otherwise, it may be related to what’s mentioned in the other thread - disconnects or idle connection timeouts.