-
-
Notifications
You must be signed in to change notification settings - Fork 16.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Node http2 - cannot read this.socket.readable #3388
Comments
Hi @PiniH since it's experimental and just landed on |
I would love to help investigate and assist with all the investigation/integration between the new http2 and express, however I would need guidance on how/where to start. |
Yea, I'd need some time to take a look at what is going on to get some pointers for where to start. |
@dougwilson From quick investigation - the first problem starts in the init function, it sets the wrong prototype - it's Http2Request/Response all the way until setPrototypeOf(req, app.request)
setPrototypeOf(res, app.response) Not sure how to proceed now :) |
Ah, the prototype. I guess that is different in the http2? Hmm, that sucks, because it is likely to be a large task to fix that. I would have assumed it wouldn't have been different, seeing as even the |
Aye, it's a different constructor, I just started playing with it today, I will look into it more tomorrow and post my findings.
|
I played with it some more, exposing Http2ServerRequest and Http2ServerResponse from node internal http2 files, and used them in the request/response files, (also had to define an empty setter for response.statusMessage - as Http2ServerResponse only defines a getter but no setter). I managed to get a response (404, but still a response ;) ) - it seems to fail at matching the route - express:router dispatching GET /express +38s
express:router query : /express +1m
express:router expressInit : /express +34s it seems to fail at a stack error (but only on the third call - not sure what's up with that yet) on // get pathname of request
var path = getPathname(req); It got the correct path 2 times and then got stackoverflow. Any idea where/how to proceed? |
What's |
From what I'm seeing, the getPathname is working properly, until the layer that's called expressInit is running (I guess that's an internal layer?), and then the getPathname fails with stackoverflow, will update soon with more details. |
Amusing... Http2ServerRequest defines getter for 'url' property as return this.path, express request.js defines 'path' as return parse(this).pathname; which calls - you guessed it, request.url :) resulting in stack overflow, when commenting out the 'path' getter in request.js I got a response. |
any progress so far? is there workaround without touching http2(or express) core? |
Hi @hansanghoon all the work is happening in the linked PR: #3390 |
This works, but it looks like the "spdy" module (which, despite its name, also supports http2) is not compatible with newer nodejs versions and should be avoided: spdy-http2/node-spdy#333 webpack/webpack-dev-server#1451 Should eventually use nodejs's native http2 module, but it is currently incompatible with express: expressjs/express#3388 Committing the changes to a branch and setting aside for now.
`spdy` is effectively unmaintained, and as a consequence of an implementation that extensively relies on Node’s non-public APIs, broken on Node 10 and above. In those cases, only https will be used for now. Once express supports Node's built-in HTTP/2 support, migrating over to that should be the best way to go. related issues: nodejs/node#21665 nodejs/node#21665 webpack#1449 expressjs/express#3388
cherry pick of webpack@e97d345 `spdy` is effectively unmaintained, and as a consequence of an implementation that extensively relies on Node’s non-public APIs, broken on Node 10 and above. In those cases, only https will be used for now. Once express supports Node's built-in HTTP/2 support, migrating over to that should be the best way to go. related issues: nodejs/node#21665 nodejs/node#21665 webpack#1449 expressjs/express#3388
cherry pick of webpack@e97d345 This commit is in webpack-dev-server v3 line, which requires webpack to be upgraded to >= 4.0.0 `spdy` is effectively unmaintained, and as a consequence of an implementation that extensively relies on Node’s non-public APIs, broken on Node 10 and above. In those cases, only https will be used for now. Once express supports Node's built-in HTTP/2 support, migrating over to that should be the best way to go. related issues: nodejs/node#21665 nodejs/node#21665 webpack#1449 expressjs/express#3388
cherry pick of webpack@e97d345 this issue was fixed is in webpack-dev-server v3 line, which requires webpack to be upgraded to >= 4.0.0. This commit cherry picks the fix to v2 branch (on top of v2.11.3) which does not require webpack to be upgraded to 4.0.0 `spdy` is effectively unmaintained, and as a consequence of an implementation that extensively relies on Node’s non-public APIs, broken on Node 10 and above. In those cases, only https will be used for now. Once express supports Node's built-in HTTP/2 support, migrating over to that should be the best way to go. related issues: nodejs/node#21665 nodejs/node#21665 webpack#1449 expressjs/express#3388
Ports fix for webpack#1449 to v2 branch cherry pick of webpack@e97d345 this issue was fixed in webpack-dev-server v3 line, which requires webpack to be upgraded to >= 4.0.0. This commit cherry picks the fix to v2 branch (on top of v2.11.3) which does not require webpack to be upgraded to 4.0.0 `spdy` is effectively unmaintained, and as a consequence of an implementation that extensively relies on Node’s non-public APIs, broken on Node 10 and above. In those cases, only https will be used for now. Once express supports Node's built-in HTTP/2 support, migrating over to that should be the best way to go. related issues: nodejs/node#21665 nodejs/node#21665 webpack#1449 expressjs/express#3388
Ports fix for webpack#1449 to v2 branch cherry pick of webpack@e97d345 this issue was fixed in webpack-dev-server v3 line, which requires webpack to be upgraded to >= 4.0.0. This commit cherry picks the fix to v2 branch (on top of v2.11.3) which does not require webpack to be upgraded to 4.0.0 `spdy` is effectively unmaintained, and as a consequence of an implementation that extensively relies on Node’s non-public APIs, broken on Node 10 and above. In those cases, only https will be used for now. Once express supports Node's built-in HTTP/2 support, migrating over to that should be the best way to go. related issues: nodejs/node#21665 nodejs/node#21665 webpack#1449 expressjs/express#3388
Ports fix for webpack#1449 to v2 branch cherry pick of webpack@e97d345 this issue was fixed in webpack-dev-server v3 line, which requires webpack to be upgraded to >= 4.0.0. This commit cherry picks the fix to v2 branch (on top of v2.11.3) which does not require webpack to be upgraded to 4.0.0 `spdy` is effectively unmaintained, and as a consequence of an implementation that extensively relies on Node’s non-public APIs, broken on Node 10 and above. In those cases, only https will be used for now. Once express supports Node's built-in HTTP/2 support, migrating over to that should be the best way to go. related issues: nodejs/node#21665 nodejs/node#21665 webpack#1449 expressjs/express#3388
Ports fix for webpack#1449 to v2 branch cherry pick of webpack@e97d345 this issue was fixed in webpack-dev-server v3 line, which requires webpack to be upgraded to >= 4.0.0. This commit cherry picks the fix to v2 branch (on top of v2.11.3) which does not require webpack to be upgraded to 4.0.0 `spdy` is effectively unmaintained, and as a consequence of an implementation that extensively relies on Node’s non-public APIs, broken on Node 10 and above. In those cases, only https will be used for now. Once express supports Node's built-in HTTP/2 support, migrating over to that should be the best way to go. related issues: nodejs/node#21665 nodejs/node#21665 webpack#1449 expressjs/express#3388
Ports fix for webpack#1449 to v2 branch cherry pick of webpack@e97d345 this issue was fixed in webpack-dev-server v3 line, which requires webpack to be upgraded to >= 4.0.0. This commit cherry picks the fix to v2 branch (on top of v2.11.3) which does not require webpack to be upgraded to 4.0.0 `spdy` is effectively unmaintained, and as a consequence of an implementation that extensively relies on Node’s non-public APIs, broken on Node 10 and above. In those cases, only https will be used for now. Once express supports Node's built-in HTTP/2 support, migrating over to that should be the best way to go. related issues: nodejs/node#21665 nodejs/node#21665 webpack#1449 expressjs/express#3388
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
I got the same error today. Any updates? |
Same here, trying to serve up a react app over http/2 using the native http module from node. I am using Any ideas ? |
is this being looked at? |
Still not working |
+1, not working |
Not working on Node |
For now, see https://medium.com/@azatmardan/http-2-with-node-js-c928b90423d0 |
FYI spdy does not work with node >= v15. |
Express does seem to have an open PR for this in version 5.0. Until then, I have created a workaround as a package(https://www.npmjs.com/package/http2-express-bridge). It worked perfectly on my application. If anyone wants to experiment with it, do check it out. Tested on node-14.15.5, express- 4.17.1 |
@rahulramesha There's a PR here: #3730 |
There's the issue here in spdy: spdy-http2/node-spdy#380 |
Testing node's new http2 native module I couldn't get express to serve requests over http2,
Using node master build with
--expose-http2
flag:When requesting /express the server crashed with the following error:
The text was updated successfully, but these errors were encountered: