Open ghost opened 3 years ago
Also different one:
Error: There was an unknown WS error. Contact the dev team about this (error code 935468). Original error: TypeError: Cannot read property 'substring' of undefined.
Hi. We highly appreciate you posting this issue.
According to the error code, it seems like there was an error while parsing an incoming reply message with an attachment. We are currently working on fixing all problems related to attachments. We will let you know when it's fixed.
Another crash:
ERR! err read ECONNRESET
node:events:346
throw er; // Unhandled 'error' event
^
Error: read ECONNRESET
at TLSWrap.onStreamRead (node:internal/stream_base_commons:211:20)
Emitted 'error' event at:
at MqttClient.<anonymous> (C:\Users\KMatuszak\Documents\bot\node_modules\ts-messenger-api\dist\lib\api.js:255:36)
at MqttClient.emit (node:events:369:20)
at Duplexify.streamErrorHandler (C:\Users\KMatuszak\Documents\bot\node_modules\ts-messenger-api\node_modules\mqtt\lib\client.js:343:12)
at Duplexify.emit (node:events:369:20)
at Duplexify._destroy (C:\Users\KMatuszak\Documents\bot\node_modules\duplexify\index.js:191:15)
at C:\Users\KMatuszak\Documents\bot\node_modules\duplexify\index.js:182:10
at processTicksAndRejections (node:internal/process/task_queues:76:11) {
errno: -4077,
code: 'ECONNRESET',
syscall: 'read',
type: 'error',
target: WebSocket {
_events: [Object: null prototype] {},
_eventsCount: 0,
_maxListeners: undefined,
readyState: 3,
bytesReceived: 135057,
extensions: null,
protocol: '',
_binaryType: 'arraybuffer',
_finalize: [Function: bound finalize] { __ultron: 0 },
_closeFrameReceived: false,
_closeFrameSent: false,
_closeMessage: '',
_closeTimer: null,
_finalized: true,
_closeCode: 1006,
_receiver: null,
_sender: null,
_socket: null,
_ultron: null,
protocolVersion: 13,
_isServer: false,
url: 'wss://edge-chat.facebook.com/chat?sid=213667968948676',
_req: null,
[Symbol(kCapture)]: false
}
}
[nodemon] app crashed - waiting for file changes before starting...
And next one 😄
ERR! err Connection refused: Server unavailable
node:events:346
throw er; // Unhandled 'error' event
^
Error: Connection refused: Server unavailable
at MqttClient._handleConnack (C:\Users\KMatuszak\Documents\bot\node_modules\ts-messenger-api\node_modules\mqtt\lib\client.js:1190:15)
at MqttClient._handlePacket (C:\Users\KMatuszak\Documents\bot\node_modules\ts-messenger-api\node_modules\mqtt\lib\client.js:424:12)
at work (C:\Users\KMatuszak\Documents\bot\node_modules\ts-messenger-api\node_modules\mqtt\lib\client.js:321:12)
at Writable.writable._write (C:\Users\KMatuszak\Documents\bot\node_modules\ts-messenger-api\node_modules\mqtt\lib\client.js:335:5)
at doWrite (C:\Users\KMatuszak\Documents\bot\node_modules\readable-stream\lib\_stream_writable.js:409:139)
at writeOrBuffer (C:\Users\KMatuszak\Documents\bot\node_modules\readable-stream\lib\_stream_writable.js:398:5)
at Writable.write (C:\Users\KMatuszak\Documents\bot\node_modules\readable-stream\lib\_stream_writable.js:307:11)
at Duplexify.ondata (C:\Users\KMatuszak\Documents\bot\node_modules\duplexify\node_modules\readable-stream\lib\_stream_readable.js:619:20)
at Duplexify.emit (node:events:369:20)
at addChunk (C:\Users\KMatuszak\Documents\bot\node_modules\duplexify\node_modules\readable-stream\lib\_stream_readable.js:291:12)
at readableAddChunk (C:\Users\KMatuszak\Documents\bot\node_modules\duplexify\node_modules\readable-stream\lib\_stream_readable.js:278:11)
at Duplexify.Readable.push (C:\Users\KMatuszak\Documents\bot\node_modules\duplexify\node_modules\readable-stream\lib\_stream_readable.js:245:10)
at Duplexify._forward (C:\Users\KMatuszak\Documents\bot\node_modules\duplexify\index.js:170:26)
at Transform.onreadable (C:\Users\KMatuszak\Documents\bot\node_modules\duplexify\index.js:134:10)
at Transform.emit (node:events:369:20)
at emitReadable_ (C:\Users\KMatuszak\Documents\bot\node_modules\websocket-stream\node_modules\readable-stream\lib\_stream_readable.js:504:10)
Emitted 'error' event at:
at MqttClient.<anonymous> (C:\Users\KMatuszak\Documents\bot\node_modules\ts-messenger-api\dist\lib\api.js:255:36)
at MqttClient.emit (node:events:369:20)
at MqttClient._handleConnack (C:\Users\KMatuszak\Documents\bot\node_modules\ts-messenger-api\node_modules\mqtt\lib\client.js:1192:10)
at MqttClient._handlePacket (C:\Users\KMatuszak\Documents\bot\node_modules\ts-messenger-api\node_modules\mqtt\lib\client.js:424:12)
[... lines matching original stack trace ...]
at Transform.onreadable (C:\Users\KMatuszak\Documents\bot\node_modules\duplexify\index.js:134:10) {
code: 3
}
[nodemon] app crashed - waiting for file changes before starting...
You are just warming up, right? :-) The two multi-line errors were caused by a websocket connection failure. When you debug and pause on a breakpoint, the websocket client loves to disconnect after some time. It occurs often when handling this type of connection.
I didn't debugged or paused on a breakpoint. My app was listening for some longer time, and unexpectedly crashed.
The ERR! err Connection refused: Server unavailable
crash happened for the second time now, let me know if you want me to inform you about these crashes.
Error: There was an unknown WS error. Contact the dev team about this (error code 935470). Original error: TypeError: Cannot read property 'messageMetadata' of undefined.
I think the MqttClient crashes are Facebook's issue. We need to add reconnect logic, but that will take some time. Until then, you will have to implement reconnect logic outside this package. (Or submit a PR :) )