guidone / node-red-contrib-chatbot-discord

Discord Nodes for RedBot
5 stars 2 forks source link

Discord Chatbot Nodes are taking down Node Red #3

Open telecomguyML opened 4 years ago

telecomguyML commented 4 years ago

I have switched over from another Discord Node Red integration (because there was no active development, not sure if this one is active either), however this error was affecting those nodes as well. It appears something may have changed on the Discord side to cause this error, or there is just too much traffic? However the node does not know how to handle the error and is bringing down Node Red. I am running Node Red in a Docker container and I have Docker restarting Node Red when it sees it down. However I believe something needs to be fixed so that it recovers on its own and does not bring down Node Red. Here is the snippet of the error from the Node Red logs:

16 Apr 13:09:13 - [red] Uncaught Exception:
16 Apr 13:09:13 - Error [ERR_UNHANDLED_ERROR]: Unhandled error. (ErrorEvent {

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: {},
_isServer: false,
_receiver: null,
_sender: null,
_socket: null,
url: 'wss://gateway.discord.gg/?v=6&encoding=json',
_req: null },
type: 'error',

message:
'getaddrinfo EAI_AGAIN gateway.discord.gg gateway.discord.gg:443',
error:

{ Error: getaddrinfo EAI_AGAIN gateway.discord.gg gateway.discord.gg:443

at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:56:26)
errno: 'EAI_AGAIN',
code: 'EAI_AGAIN',
syscall: 'getaddrinfo',
hostname: 'gateway.discord.gg',
host: 'gateway.discord.gg',
port: 443 } })
at Client.emit (events.js:187:17)
at WebSocketConnection.onError (/data/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:374:17)
at WebSocket.onError (/data/node_modules/ws/lib/event-target.js:128:16)
at WebSocket.emit (events.js:198:13)
at ClientRequest.req.on (/data/node_modules/ws/lib/websocket.js:551:10)
at ClientRequest.emit (events.js:198:13)
at TLSSocket.socketErrorListener (_http_client.js:401:9)
at TLSSocket.emit (events.js:198:13)
at emitErrorNT (internal/streams/destroy.js:91:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
at process._tickCallback (internal/process/next_tick.js:63:19)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-red-docker@1.0.5 start: `node $NODE_OPTIONS node_modules/node-red/red.js $FLOWS "--userDir" "/data"`
npm ERR! Exit status 1

npm ERR! Failed at the node-red-docker@1.0.5 start script.

npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /usr/src/node-red/.npm/_logs/2020-04-16T17_09_13_493Z-debug.log

Not sure what else is needed to troubleshoot this, but I am seeing this frequently and causes Node Red to crash multiple times per day.

m4dm4rtig4n commented 4 years ago

Hi, i have same problem...

When gateway.discord.gg is unreachable for X reason, Node-RED Crash :/