szmarczak / http2-wrapper

Use HTTP/2 the same way like HTTP/1
MIT License
239 stars 18 forks source link

The 2.0.4 release breaks our integrations #72

Closed mnmkng closed 3 years ago

mnmkng commented 3 years ago

This commit 23ff7f7906d735cb25b9cd88ab665bafa2cbd1c9 introduced this piece of code:

session.setLocalWindowSize(1024 * 1024 * 4); // 4 MB

Which causes our usage of this package to fail with:

2021-04-27T09:54:31.734Z /usr/src/app/node_modules/got-scraping/node_modules/http2-wrapper/source/agent.js:535
2021-04-27T09:54:31.737Z                        session.setLocalWindowSize(1024 * 1024 * 4); // 4 MB
2021-04-27T09:54:31.738Z                                ^
2021-04-27T09:54:31.739Z 
2021-04-27T09:54:31.740Z TypeError: session.setLocalWindowSize is not a function
2021-04-27T09:54:31.741Z     at ClientHttp2Session.<anonymous> (/usr/src/app/node_modules/got-scraping/node_modules/http2-wrapper/source/agent.js:535:15)
2021-04-27T09:54:31.741Z     at Object.onceWrapper (events.js:422:26)
2021-04-27T09:54:31.742Z     at ClientHttp2Session.emit (events.js:315:20)
2021-04-27T09:54:31.743Z     at Http2Session.onSettings (internal/http2/core.js:542:11)

I suggest reverting the latest release before a solution to the Node.js bug you reported can be found.

Thanks!

mnmkng commented 3 years ago

We fixed it by pinning the version to 2.0.3, but I assume other users might be affected as well. https://github.com/apify/got-scraping/pull/18

szmarczak commented 3 years ago

Released 2.0.5. I recommend switching at least to Node.js 15. HTTP/2 is extremely unreliable under Node.js <15.