I am kind of new to coding and I needed some help with one error that I'm getting.
I'm running a NodeJS application (a Discord.js bot), my bot has the function to register a user's ID to a MySQL database when the user types a certain command. Sometimes it works just fine, but other times it crashes with an ECONNRESET
error:
events.js:292
throw er; // Unhandled 'error' event
^
Error: read ECONNRESET
at TCP.onStreamRead (internal/stream_base_commons.js:205:27)
Emitted 'error' event on Connection instance at:
at Connection._handleProtocolError (C:\Users\Celeron\Desktop\DiscordBot\node_modules\mysql\lib\Connection.js:423:8)
at Protocol.emit (events.js:315:20)
at Protocol._delegateError (C:\Users\Celeron\Desktop\DiscordBot\node_modules\mysql\lib\protocol\Protocol.js:398:10)
at Protocol.handleNetworkError (C:\Users\Celeron\Desktop\DiscordBot\node_modules\mysql\lib\protocol\Protocol.js:371:10)
at Connection._handleNetworkError (C:\Users\Celeron\Desktop\DiscordBot\node_modules\mysql\lib\Connection.js:418:18)
at Socket.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) {
errno: 'ECONNRESET',
code: 'ECONNRESET',
syscall: 'read',
fatal: true
}