madmax3365 / node-red-node-discord

Discord nodes for node-red
6 stars 9 forks source link

Uncaught exception killing NodeRed entirely #15

Open Aterfax opened 3 years ago

Aterfax commented 3 years ago

Seeing an uncaught exception which kills node-red outright:

message: 'Client network socket disconnected before secure TLS connection was established',

The exception probably just needs catching.

Relevant log output:

    24 Jul 16:11:11 - Error [ERR_UNHANDLED_ERROR]: Unhandled error. (ErrorEvent {
    target: WebSocket {
    _events: [Object: null prototype] {
    message: [Function],
    open: [Function],
    error: [Function],
    close: [Function]
    },
    _eventsCount: 4,
    _maxListeners: undefined,
    readyState: 2,
    protocol: '',
    _binaryType: 'nodebuffer',
    _closeFrameReceived: false,
    _closeFrameSent: false,
    _closeMessage: '',
    _closeTimer: null,
    _closeCode: 1006,
    _extensions: {},
    _receiver: null,
    _sender: null,
    _socket: null,
    _isServer: false,
    _redirects: 0,
    url: 'wss://gateway.discord.gg/?v=6&encoding=json',
    _req: null,
    [Symbol(kCapture)]: false
    },
    type: 'error',
    message: 'Client network socket disconnected before secure TLS connection was established',
    error: Error: Client network socket disconnected before secure TLS connection was established
    at connResetException (internal/errors.js:609:14)
    at TLSSocket.onConnectEnd (_tls_wrap.js:1547:19)
    at Object.onceWrapper (events.js:421:28)
    at TLSSocket.emit (events.js:327:22)
    at endReadableNT (_stream_readable.js:1221:12)
    at processTicksAndRejections (internal/process/task_queues.js:84:21) {
    code: 'ECONNRESET',
    path: undefined,
    host: 'gateway.discord.gg',
    port: 443,
    localAddress: undefined
    }
    })
    at Client.emit (events.js:304:17)
    at WebSocketConnection.onError (/data/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:377:17)
    at WebSocket.onError (/data/node_modules/discord.js/node_modules/ws/lib/event-target.js:128:16)
    at WebSocket.emit (events.js:315:20)
    at ClientRequest.<anonymous> (/data/node_modules/discord.js/node_modules/ws/lib/websocket.js:568:15)
    at ClientRequest.emit (events.js:315:20)
    at TLSSocket.socketErrorListener (_http_client.js:426:9)
    at TLSSocket.emit (events.js:315:20)
    at emitErrorNT (internal/streams/destroy.js:92:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)
    npm ERR! code ELIFECYCLE
    npm ERR! errno 1
    npm ERR! node-red-docker@1.1.2 start: `node $NODE_OPTIONS node_modules/node-red/red.js $FLOWS "--userDir" "/data"`
    npm ERR! Exit status 1
madmax3365 commented 3 years ago

Hey @Aterfax , I know it's quite late for the response )) Can you please provide some more details about this issue, if it's still relevant of course?

Aterfax commented 3 years ago

I haven't been using this for quite some time so I don't really have anything further to add I'm afraid. Replicating the error should be trivial - simply cut the connection to discord's servers and I think it will die taking the node-red instance with it.