stream-utils / raw-body

Get and validate the raw body of a readable stream

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

2.5.0 breaks koa bodyparser on startup

lucasmarcelli opened this issue · comments

Hello.

The 2.5.0 release breaks the package co-body which is depended on by koa-bodyparser. The error is:

TypeError: Cannot read property 'split' of undefined at toIdentifier (/usr/src/app/node_modules/toidentifier/index.js:24:6) and the stack trace points to raw-body as the ultimate source. I added a resolution in package.json to force raw-body to 2.4.3 and the issue was resolved.

Hello, and sorry about that! Is there any more information you can provide to help diagnose? A reproducable example, Node.js version, perhaps the stack trace you are referring to that shows where in raw-body?

Screen Shot 2022-02-22 at 10 12 55 AM

here's a screenshot of the trace

I am not sure how to give you a reproducible example. Using the latest version of koa-bodyparser without a resolution pinning this package 2.4.3 will fail like above. App is running on node 14.

Thank you. The unless I am missing something, the stack trace provided above shows the error from the http-errors packages, not raw-body.

Without some way to reproduce the issue, it is difficult to help. You're encouraged to submit a patch to whatever relevant module the issue it at if you debug it, or I am happy to if you have provide steps to reproduce.

http-errors is a dependency of raw-body, and the issue is resolved when downgrading raw-body to 2.4.3. It seems like it's an issue introduced in 2.5.0 especially since http-errors has not had a release in 2 months.
Screen Shot 2022-02-22 at 12 22 40 PM

Hi @lucasmarcelli I'm happy to take a look, but I created a simple app that uses koa-bodyparser and didn't have any issues, even though raw-body 2.5.0 was installed. I'm not sure what the issue is, and there just isn't enough information for me to determine that, as I tried to follow the information you provided. Our test suite passes, and even the koa-bodyparser test suite passes with raw-body 2.5.0 installed. I tried on Node.js 14.19.0 as well since you said you were using Node.js 14.

I'm at a loss for what, exactly, needs to be changed in order to resolve your issue. I wish I did, of course. If you can provide code and step by step instructions on how to reproduce the error, I would be happy to investigate the solution.

I'll let you know if i can get a good example for you. In the meantime keeping raw-body at 2.4.3 is fine for me.