compression icon indicating copy to clipboard operation
compression copied to clipboard

fix: call underlying implementation properly

Open fernandolguevara opened this issue 1 year ago • 33 comments

related issue #5431

fernandolguevara avatar Jul 10 '22 06:07 fernandolguevara

@dougwilson I just added a test.

fernandolguevara avatar Jul 10 '22 07:07 fernandolguevara

It is 3:30am my time, so I am headed off now. I'll be back tomorrow if I have time. Thanks for your hard work!

dougwilson avatar Jul 10 '22 07:07 dougwilson

@dougwilson do u think we can merge of this fix or there are something missing?

fernandolguevara avatar Jul 11 '22 15:07 fernandolguevara

Hi @fernandolguevara 👋 . Yea, I replied about the callback and also there is the comment regarding the tests that are still missing.

dougwilson avatar Jul 11 '22 15:07 dougwilson

Looks like some tests is failed. @fernandolguevara can you finish this PR? Seems very important for SvelteKit.

stalkerg avatar Jul 16 '22 03:07 stalkerg

@dougwilson can u approve the CI?

fernandolguevara avatar Jul 20 '22 13:07 fernandolguevara

@dougwilson, do you know if I can run the CI locally? I'm using arm64, I don't know if the docker images will be compatible

fernandolguevara avatar Jul 20 '22 13:07 fernandolguevara

Hi @fernandolguevara the CI just runs npm run test-ci command. You can run that locally.

dougwilson avatar Jul 20 '22 18:07 dougwilson

Thanks for making this change, waiting eagerly for this change to roll out 🙏

itssumitrai avatar Jul 22 '22 07:07 itssumitrai

@dougwilson that command works perfectly on my local environment, but seems to be an error with the github actions env, unfortunately I can't reproduce the CI error on my local env, I tried to build a docker container using the node 0.8 image but I can't run the test-ci command bc I got an error message when installing project dependencies.

can u help me to fix this issue?

fernandolguevara avatar Jul 22 '22 13:07 fernandolguevara

it seems like a syntax issue (too old nodejs?) in third party library supports-color, I suppose nothing related to such a fix.

stalkerg avatar Jul 22 '22 14:07 stalkerg

Do we really need to support some of these old node versions ? Before Node 14 all versions has been EOLed a while back https://endoflife.date/nodejs

itssumitrai avatar Jul 22 '22 16:07 itssumitrai

Seems like a good opportunity to deprecate old Node versions and for a major version bump in this module. Since this basically runs in every single Express app, I'm sure they need to support super old versions of Node. But modernizing would be a good idea as more frameworks implement streaming responses, e.g. SvelteKit.

coryvirok avatar Jul 22 '22 20:07 coryvirok

Yikes... some of the dependencies have high severity security issues. More cause for upgrades and modernization.

image

coryvirok avatar Jul 22 '22 20:07 coryvirok

Hi @fernandolguevara I am not currently by a computer but didn't want you to think I didn't see your message. I went in gh actions and reran a bunch of them just to make sure they were succeeding outside of the pr. So yea, I'm not sure what change in this pr is causing that strange error, but I will look as soon as I can.

As for deprecating old Node.js versions, I think that is fine. Ideally if this change can work in them that would be ideal, at least to make a final release with this before a major and forcing folks to make a harder decision. I don't see any particular reason it shouldn't work for all the Node.js versions, but I haven't looked in to that yet. I see Node.js 10 shows a failure just on one of the tests added, and Node.js 4 a syntax error. So seems a multitude of errors. Has the change at least been validated in all the Node.js versions still in support by Node.js project, at least?

As for security issues in dependencies, we should not have any, but I am not at a computer to check, so I will have to take your word for it @coryvirok . I thought I had just updated a bunch of them a couple months ago, so I guess there are some new ones...

dougwilson avatar Jul 22 '22 21:07 dougwilson

the error in node 10 occurs bc the runtime does not trigger the ERR_STREAM_DESTROYED error, should we skip this test?

https://github.com/nodejs/node/blob/v10.24.1/lib/_http_outgoing.js#L47

fernandolguevara avatar Jul 23 '22 12:07 fernandolguevara

@dougwilson hello, sorry for interrupting but do you have any time frame for fixing it? Like this week or this month?

stalkerg avatar Jul 25 '22 03:07 stalkerg

Hi @dougwilson if you could please review this again 🙏

itssumitrai avatar Jul 28 '22 19:07 itssumitrai

Hi @itssumitrai I don't think there has been any changes to the code since my last comment. Anyone is welcome to dig in and help the OP with changes to fix the issues with the build in this PR, not just me. I did volunteer to help as soon as I can, though. I am just away still since my comment and haven't gotten home to my computer to really run code and dig in to the issue, but I will as soon as I do.

I am really concerned with the findings that @coryvirok posted above, so I do plan to look into that before this, as of course fixing security issues is of the up-most importance.

dougwilson avatar Jul 28 '22 19:07 dougwilson

@dougwilson, I did a check and here are my results. Hope this reduces your load.

Commit Vulnerabilities
https://github.com/expressjs/compression/commit/ad5113b98cafe1382a0ece30bb4673707ac59ce7 0
https://github.com/fernandolguevara/compression/commit/6d20bec91fed1220a564df04f71ea9b5c243151e 0

lamweili avatar Jul 31 '22 05:07 lamweili

Hi, the build seems to be failing on Nodejs 0.8

npm ERR! TypeError: Object.keys called on non-object
npm ERR!     at Function.keys (native)
npm ERR!     at installTargetsError (/home/runner/.nvm/v0.8.28/lib/node_modules/npm/lib/cache.js:708:24)
npm ERR!     at /home/runner/.nvm/v0.8.28/lib/node_modules/npm/lib/cache.js:641:10
npm ERR!     at saved (/home/runner/.nvm/v0.8.28/lib/node_modules/npm/node_modules/npm-registry-client/lib/get.js:138:7)
npm ERR!     at Object.oncomplete (fs.js:108:15)
npm ERR! If you need help, you may report this log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <[email protected]>

Because its expected as assert-is-uint8array pkg added in this PR only supports 0.10 and above https://github.com/stdlib-js/assert-is-uint8array/blob/main/package.json#L59

@fernandolguevara maybe you should disable Nodejs 0.8 from the workflow if you want to use this pkg ?

itssumitrai avatar Aug 01 '22 21:08 itssumitrai

@dougwilson can you run the checks again? now seems to be working on all defined versions

fernandolguevara avatar Aug 06 '22 14:08 fernandolguevara

@dougwilson how do you want to proceed with the merge of this change?

fernandolguevara avatar Aug 13 '22 16:08 fernandolguevara

Hey! So I ran the gh actions as you asked, and I was thinking you were going to fix the failure listed there. If not, let me know and I can jump in and help out. Ideally we'd want a green CI before merging, and ideally also a code review, which I haven't done just yet as I wasn't sure if you were done with making changes.

dougwilson avatar Aug 13 '22 16:08 dougwilson

@dougwilson I just added some tests to increase the codecoverage, there are only 3 lines left with specific code for node 0.8, can you help me with those?

fernandolguevara avatar Aug 16 '22 12:08 fernandolguevara

@dougwilson ping

fernandolguevara avatar Aug 25 '22 00:08 fernandolguevara

Hi @fernandolguevara thanks for your ping. I will circle back on this asap once I finish working with a security vulnerability report on a diff module 👍 Sorry it got lost. If you could ping me again next week, that will help make sure it is lot lost again in the sea of notifications.

dougwilson avatar Apr 10 '23 15:04 dougwilson

Also not sure why this PR our github actions workflow will not run on. You may need to reopen a new pr to see if that fixes it. Or maybe a new push will kick it off. There is no option for me to even run manually.

dougwilson avatar Apr 10 '23 15:04 dougwilson

@fernandolguevara if I dropped 0.8 for this, would thay simplify the code and hacks? Or even anything less than Node.js 4?

dougwilson avatar Apr 10 '23 15:04 dougwilson

@dougwilson

here u can check CI Results

https://github.com/fernandolguevara/compression/actions/runs/4666297771

fernandolguevara avatar Apr 11 '23 10:04 fernandolguevara