In production, when a client disconnects
In production, when a client disconnects it shows a Canceled Error even if the WebSocket is closed properly with a
socket.close()
from the browser when the window closes. Is there a way to prevent the errors from being thrown for normal behavior? Everything works fine and no errors are thrown locally. Everything in the Worker is already in a try/catch
. Thank you!
This question I asked in this thread here but I have not received a reply so maybe others will see the question.
https://discord.com/channels/595317990191398933/773219443911819284/threads/12778642902961357119 Replies
@Zach canceled in the logs / wrangler tail you mean?
In the wrangler tail for prod but also in the dashboard logs for the worker. In the dashboard it shows as a
Client Disconnected
error. ThanksI've brought it up with the team, will get back to you. Do you have a close handler in your DO?
Thank you. Yes, there is a close handler. It's based on the websocket chat example cloudflare provides: webSocketClose, webSocketMessage, etc. Again, there is no error locally, it's just in prod. If there is no error locally it's not clear what would be causing this error in prod.
I don't think it's an error, we might just be reporting the outcome incorrectly. I vaguely recall seeing something about websockets always being described as disconnected...
Right, that would make sense.
@Milan any news?
Not going to be prioritized until after https://www.cloudflare.com/en-ca/birthday-week/ (2024 version). We've got a meeting set to go over logging in late Sept, but it's going to be a while before this gets fixed (don't know how long just yet but I'll set a reminder and come back with an update). The most likely cause is a race condition but we aren't able to investigate further right now. We'd like to make broader improvements to logging so the fix for this will get batched with other planned work
Birthday Week 2023 | Cloudflare
This week we'll celebrate our 13th birthday. As has become our tradition, we'll be announcing a series of products that we think of as our gifts back to the Internet. See what is new for today.
Ok. Thank you for the update