I have a node.js server that uses SSE to send updates to attached clients. Occasionally, I get a server error H27. At the same time, other client requests get lost probably while the client is re-registering to the SSE event service.
The time elapsed between the client GET /event request and the server H27 error is anywhere between 13sec to 19:35min (in 30 different occurrences encountered). But there is a full correlation between the timing of the GET /event request and a corresponding H27 error. I am sending a keep alive message from the server every 50sec to workaround the Heroku timeout limit of 55sec.
Here is an example for the full warning I get in Heroku logs: 2020-10-17T08:49:04.525770+00:00 heroku[router]: sock=client at=warning code=H27 desc="Client Request Interrupted" method=GET path="/event" host=appname.herokuapp.com request_id=c4c4e2fd-16ca-4292-a27b-2a70b12b16fa fwd="77.138.167.76" dyno=web.1 connect=1ms service=9499ms status=499 bytes= protocol=https
that resulted from the following GET request: 2020-10-17T08:48:55.027638+00:00 app[web.1]: Client 8 registered
Any idea how I can overcome this? My problem is that my application heavily relies on SSE, and if I now must switch to another mechanism (e.g., socket), it will take a considerable effort.
EDIT On further investigation, this seems to occur due to the client being unable to STAY connected to the Server Sent Events route on Heroku servers. While it can establish the first connection, it cannot stay connected. I suspect it has to do something with Heroku Request Timeouts and the way Heroku handles routing in general.
I still have not found a solution for this problem so everyone please feel free to comment.
code=H27 desc="Client Request Interrupted"
. I pretty much broke my head all day over it because I thought it was a problem in my code but I think it. is a Heroku specific problem. Are you by any chance using any Heroku add-ons? – philosopher