Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to stop the error 'read ECONNRESET' from happening

I've made a lot of bots, hosted some on my personal laptop, and some on Heroku, but in both, I received this error that terminated node.js, so I used bot.on('error', console.error) to view the error and here's the result:

type: 'error', message: 'read ECONNRESET', error: {
  Error: read ECONNRESET at TLSWrap.onStreamRead(internal / stream_base_commons.js: 111: 27) errno: 'ECONNRESET',
  code: 'ECONNRESET',
  syscall: 'read'
}

If anyone knows how to stop that from happening, please tell me.

like image 267
GamesProSeif Avatar asked Jan 28 '19 18:01

GamesProSeif


People also ask

What does error read Econnreset mean?

You might have guessed it already: it's a connection error. "ECONNRESET" means the other side of the TCP conversation abruptly closed its end of the connection. This is most probably due to one or more application protocol errors. You could look at the API server logs to see if it complains about something.

What is error read Econnreset in Postman?

Usually means the resource you are requesting isn't found or you are hitting the wrong URL, Check your hostname, endpoint, resource requested, SSL certificate required if any !


1 Answers

"ECONNRESET" usually happens when another end of the TCP connections closes its end due to any protocol-related errors and since no one is listening to the 'error' event it gets thrown, to deal with it you should put a listener which can handle such erroneous condition.

You can refer to such exception handling here node-js-best-practice-exception-handling

like image 122
Ashish Avatar answered Oct 28 '22 11:10

Ashish