Tag Archives: body-parser

Nodejs HTTP call error: socket hang up

[ERROR: Socket Hang up] code: ‘ECONNRESET’}

Analysis reason: For some reason, the HTTP target address establishment socket connection error

Error resolution: After
Compared with the search, I found that there was a use of the middleware “body-parser” in the NodeJS project here, so there is no problem to remove it

There are other reasons that I haven’t come across here, but I won’t go into them,

[nodejs] error request aborted after request routing in post mode

The introduction of
I added a new route to my project to try to add some functionality. After the function code was added, I found that the page was loading all the time when I submitted the POST request. At this time, I went to the console and reported something wrong: BadRequestError: Request Aborted
This makes me very confused. Separate test function code and the existing project when it is working well, but can be combined together to die, what is the reason?
why
Encounter the problem first Baidu, but goose Baidu a day also did not Baidu to, basically still do not know what the problem is only an error information request aborted also do not know Baidu what…
Then you can only hard look at the error message in an attempt to discover the cause. First look at the error message: \node_modules\raw-body\index.js:231:10


annotation of these two lines of code is ok, but the problem comes, I can’t change the processing library, how much code should be changed.
Then I still can’t find the reason, and finally in the chat with the boss was the boss out of ! Sure enough, a proper route was run before the function code, and post requests were processed using express-formidable, a formidable component that clashed between the body-parser and express-formidable, causing Request Aborted