question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

cannot pipe request after body-parser

See original GitHub issue

I’m using body-parser to limit the size of a POST body. Adding the following line a request with some 3MB stucks on ‘100 continue’. No data is written.

app.use(bodyParser.raw({ limit: '5mb' }));

A request with 400kB is successful. Removing the above line the 3MB request (and larger requests) work fine. I’m using version 1.12.3. Maybe I have overseen something!?

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
dougwilsoncommented, Apr 24, 2015

Ah, thanks, that fss usage is where your problem is. You can only read a stream one time in Node.js. req was already read into req.body ny this module, so your req.pipe is what’s hanging. You just need to do writable.end(req.body) and remove readable.pipe(writeable).

0reactions
dougwilsoncommented, Apr 24, 2015

My pleasure 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Node's request does not pass POST requests using pipe
The above code executes get requests just fine placed as a middleware in an express router, however on POST the proxiedServer never receives...
Read more >
Piping request to another server doesn't work with request body
I'm using postman to test my API. I'm attempting to pipe the requests through my API to the corresponding services (also node). Everything...
Read more >
express.Request.pipe JavaScript and Node.js code examples
assignKey(req.query); //Pipe is through request, this will just redirect //everything from the api to your own server at localhost. //It will also pipe...
Read more >
Running Collection with a GET to an API and a POST to a ...
the GET request returns JSON containing multiple objects each with multiple name:value pairs inside a single array in a single object named ...
Read more >
ExpressJS Form Data - Pabbly
Equipped with two major HTML forms GET request & POST request. ... and use the below code to install the body-parser(for parsing JSON...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found