New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closing WebSocket in Durable Object results in Unhandled Promise Rejection: TypeError: WebSocket already closed #331
Comments
Hey! 👋 Thanks for reporting this. I think I get what's going on here, but would you be able to share a minimal reproduction? |
Alright, I'll prepare a repo for that. |
I'm holding up this issue for now, since I am preparing a repo for the Wrangler team on another related issue. I'll get back here once that is sorted. |
You know what @mrbbot? I'll close this issue here for now. Since you're active in Wrangler2, I'll recreate it there once I get to the point of WebSocket connections working with the most recent Wrangler (there are quite some bugs left). I'll recreate this issue there, if it's still the case. Thanks! |
Hey @mrbbot I moved out to vanilla Miniflare, so I am reopening this issue. Here is the reproduction repo you asked for: https://github.com/awthwathje/miniflare-debug-example |
Hey! 👋 Thanks for the repo! 🙂 I'm able to reproduce the issue, and will have a go at fixing this soon. 👍 |
Thanks for fixing @mrbbot! Appreciated! ❤️ |
Hey! 👋 Miniflare |
Miniflare version: 2.6.0
While closing the WebSocket from the client side, it is expected to close it in the Durable Object right after, otherwise it won't be closed. So closing negotiation goes like: Client > DO > Client.
Miniflare however throws
Unhandled Promise Rejection: TypeError: WebSocket already closed
error when Durable Object tries to close the socket when the 'close' event is received from the client.Apparently, with Miniflare the client is able to close the socket prematurely without waiting for the Durable Object to close the server socket first.
The text was updated successfully, but these errors were encountered: