xmpp.js
xmpp.js copied to clipboard
Uncaught (in promise) TypeError: Cannot read properties of null (reading 'write')
⚠ If you need help with XMPP itself, please visit https://xmpp.org/community/ instead.
It looks like socket can be possibly null while Client.write is called
Error stack trace
VM4851 chunk-QKGHVZFU.js:317 Uncaught (in promise) TypeError: Cannot read properties of null (reading 'write')
at VM4851 chunk-QKGHVZFU.js:317:23
at new Promise (<anonymous>)
at Client.write (VM4851 chunk-QKGHVZFU.js:312:16)
at Client.send (VM4851 chunk-QKGHVZFU.js:302:20)
at Client.send (VM4734 @xmpp_websocket.js:152:22)
at Client.send (VM4733 @xmpp_client-core.js:29:46)
at IQCaller.request (VM4737 @xmpp_iq_caller.js:93:29)
at IQCaller._childRequest (VM4737 @xmpp_iq_caller.js:106:21)
at IQCaller.set (VM4737 @xmpp_iq_caller.js:114:21)
at bind (VM4743 @xmpp_resource-binding.js:19:37)
A clear and concise description of what the bug is.
@xmpp/client: 0.13.1
how do you reproduce? this might be a bug in your code
ie - don't call send or write if you're not connected
Sadly I don't have a nice reproduction. Looking at the stack trace I suspect this is originating from resource binding https://github.com/xmppjs/xmpp.js/blob/ee361dc968cde84dfb4295d840c534d36bcecfc3/packages/resource-binding/index.js#L15 perhaps some race condition when client disconnects
We'll need to find with certainty the source of the exception. Then understand why it is uncaught.
A good starting place is to check if a stream feature throwing results in an uncuaght exception
https://github.com/xmppjs/xmpp.js/blob/main/packages/stream-features/index.js (this is what resource biding uses so that's a good usage example
stream-features is the only module without tests so it could also benefit from that
Might be solved in 0.14
otherwise feel free to reopen