Node, Express and { [Error: socket hang up] code: ‘ECONNRESET’ }

March 29, 2015
Reading Time: 1 minute

I’m not sure how many scenarios this issue would crop up in, but I wanted to at least post about the one that I found:

This happens on my iojs/express api that I’m working on, and trying to do a file upload test with mocha and supertest.

If you are doing something like this:

.attach() is not compatible with .send().

You need to remove .send() and put that data into .field() function calls like this:

Doing this completely resolved theĀ { [Error: socket hang up] code: ‘ECONNRESET’} error that I was receiving.

Hope this helps anyone with the same issue.

Leave a Reply

Your email address will not be published. Required fields are marked *