biancamihai
biancamihai

Reputation: 981

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!

Upvotes: 3

Views: 4631

Answers (1)

paulsm4
paulsm4

Reputation: 121769

Two extremely useful troubleshooting tools:

See also:

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.

Upvotes: 1

Related Questions