App connection timeout

2022-05-27T18:11:00Z app[7c712c82] fra [info]INFO:     145.40.94.27:38344 - "OPTIONS /api/predict HTTP/1.1" 200 OK
error.message="App connection idle" 2022-05-27T18:57:27Z proxy[7c712c82] fra [warn]error.code=2004 request.method="POST"
 request.url="https://api.ml.lexai.co/predict" request.id="01G43BC2PXPGW3GQMDS252S8XP-fra" response.status=502

I am getting this error on a long running connection. The server is receiving the POST request but needs 3min to 5min before answering. Can I do something about it?

We close connections after 60s of inactivity.

You have a few options:

  • You can change your app’s behaviour to send back a Accepted status code (or something like that) and then poll for the result later on, in a loop, from your client.
  • You can keep sending data (like a ping) to keep the connection from being considered idle.
  • Longer idle timeouts will be available via upcoming paid plans.