Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: read ECONNRESET using the request module

I try to download and parse some big xml files. The files are from some affiliates sites that don't have a proper API right now. I use the request module for nodejs but I allways get the same error.

Error: read ECONNRESET
at exports._errnoException (util.js:746:11)
at TCP.onread (net.js:559:26)

If I load the same url in the browser or I user curl from the command line I get the results.

request('[my-url].xml', function(err, response, body){
    // I get the error here in err
});

Any ideea how can I fix this? Thank you!

like image 902
biancamihai Avatar asked Jun 10 '26 23:06

biancamihai


1 Answers

Two extremely useful troubleshooting tools:

  • longjohn

  • Fiddler2

See also:

  • Node js ECONNRESET

  • Telerik forums: Node.js traffic

ADDENDUM:

  • I would definitely encourage you to explore longjohn, Fiddler2 and/or other tools for troubleshooting the HTTP-level requests/responses to and from your application.

  • I noticed joews and I both cited the same Stack Overflow link. Useful takeways:

    a. --abort-on-uncaught-exception node.js option: Not only it provides much more verbose and useful error stack trace, but also saves core file on application crash allowing further debug.

    b. I was facing the same issue but I mitigated it by placing server.timeout = 0; before server.listen.

like image 106
paulsm4 Avatar answered Jun 14 '26 07:06

paulsm4



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!