express: Node http2 - cannot read this.socket.readable
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:
const express = require('express');
const app = express();
app.get('/express', (req, res) => {
res.send('Hello from express');
});
const server = http2.createSecureServer({
key,
cert
}, app);
When requesting /express the server crashed with the following error:
(node:80731) ExperimentalWarning: The http2 module is an experimental API.
_http_incoming.js:104
if (this.socket.readable)
^
TypeError: Cannot read property 'readable' of undefined
at IncomingMessage._read (_http_incoming.js:104:18)
at IncomingMessage.Readable.read (_stream_readable.js:431:10)
at IncomingMessage.read (_http_incoming.js:96:15)
at resume_ (_stream_readable.js:811:12)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
About this issue
- Original URL
- State: open
- Created 7 years ago
- Comments: 26 (5 by maintainers)
Commits related to this issue
- Work-in-progress HTTP2 support via "spdy" module 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... — committed to shesek/spark-wallet by shesek 6 years ago
- Fix server: don't use spdy on node >= v10.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 ab... — committed to RohanBhanderi/webpack-dev-server by deleted user 6 years ago
- Fix server: don't use spdy on node >= v10.0.0 cherry pick of https://github.com/webpack/webpack-dev-server/pull/1451/commits/e97d345ac370095a6e339b7997b939c88ef3e81b `spdy` is effectively unmaintain... — committed to RohanBhanderi/webpack-dev-server by deleted user 6 years ago
- Fix server: don't use spdy on node >= v10.0.0 cherry pick of https://github.com/webpack/webpack-dev-server/pull/1451/commits/e97d345ac370095a6e339b7997b939c88ef3e81b This commit is in webpack-dev-se... — committed to RohanBhanderi/webpack-dev-server by deleted user 6 years ago
- Fix server: don't use spdy on node >= v10.0.0 cherry pick of https://github.com/webpack/webpack-dev-server/pull/1451/commits/e97d345ac370095a6e339b7997b939c88ef3e81b this issue was fixed is in webpa... — committed to RohanBhanderi/webpack-dev-server by deleted user 6 years ago
- Fix server: don't use spdy on node >= v10.0.0 Ports fix for https://github.com/webpack/webpack-dev-server/issues/1449 to v2 branch cherry pick of https://github.com/webpack/webpack-dev-server/pull/14... — committed to RohanBhanderi/webpack-dev-server by deleted user 6 years ago
- Fix server: don't use spdy on node >= v10.0.0 Ports fix for https://github.com/webpack/webpack-dev-server/issues/1449 to v2 branch cherry pick of https://github.com/webpack/webpack-dev-server/pull/14... — committed to RohanBhanderi/webpack-dev-server by deleted user 6 years ago
- Fix server: don't use spdy on node >= v10.0.0 Ports fix for https://github.com/webpack/webpack-dev-server/issues/1449 to v2 branch cherry pick of https://github.com/webpack/webpack-dev-server/pull/14... — committed to RohanBhanderi/webpack-dev-server by deleted user 6 years ago
- Fix server: don't use spdy on node >= v10.0.0 Ports fix for https://github.com/webpack/webpack-dev-server/issues/1449 to v2 branch cherry pick of https://github.com/webpack/webpack-dev-server/pull/14... — committed to RohanBhanderi/webpack-dev-server by deleted user 6 years ago
- Fix server: don't use spdy on node >= v10.0.0 Ports fix for https://github.com/webpack/webpack-dev-server/issues/1449 to v2 branch cherry pick of https://github.com/webpack/webpack-dev-server/pull/14... — committed to RohanBhanderi/webpack-dev-server by deleted user 6 years ago
- won't work until express supports http/2 https://github.com/expressjs/express/issues/3388 — committed to sifrr/sifrr by aadityataparia 5 years ago
Still not working
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. @jasnell
I am still seeing this issue with Node v10.14.1 and express@4.16.4. Is there any timeline on resolving this problem?
Amusing…
Http2ServerRequest defines getter for ‘url’ property as return this.path, express request.js defines ‘path’ as
which calls - you guessed it, request.url 😃 resulting in stack overflow, when commenting out the ‘path’ getter in request.js I got a response.
Not working on Node
14.5.0
, express4.17.1
Same here, trying to serve up a react app over http/2 using the native http module from node.
I am using
"express": "4.17.1"
on Nodev12.13.0
Any ideas ?
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