You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
express crashing when using node internal http2 module on sending any request from client #6580
Platform: Linux d176f8ed3db8 5.15.146.1-microsoft-standard-WSL2 #1 SMP Thu Jan 11 04:09:03 UTC 2024 x86_64 GNU/Linux (Docker image from node:23-slim), Microsoft Windows NT 10.0.19045.0 x64
node:events:502
throw er; // Unhandled 'error' event
^
TypeError: Cannot read properties of undefined (reading 'readable')
at IncomingMessage._read (node:_http_incoming:211:19)
at Readable.read (node:internal/streams/readable:739:12)
at resume_ (node:internal/streams/readable:1257:12)
at process.processTicksAndRejections (node:internal/process/task_queues:90:21)
Emitted 'error' event on IncomingMessage instance at:
at emitErrorNT (node:internal/streams/destroy:170:8)
at errorOrDestroy (node:internal/streams/destroy:239:7)
at Readable.read (node:internal/streams/readable:741:7)
at resume_ (node:internal/streams/readable:1257:12)
at process.processTicksAndRejections (node:internal/process/task_queues:90:21)
Error persists even without using http2-express-bridge
What steps will reproduce the bug?
Install express and http2-express-bridge dependency with npm
Generate ssl key and cert file with openssl directly or using wsl
Write index.mjs like
import fs from "fs";
import path from "path";
import http2 from "http2";
import express from "express";
import http2Express from "http2-express-bridge";
const app = http2Express(express);
const tlsOptions = {
key: fs.readFileSync(path.join("certs", "ssl.key")),
cert: fs.readFileSync(path.join("certs", "ssl.crt")),
};
app.get("/", function(req, res) {
res.send("Hello World");
});
const server = http2.createSecureServer(tlsOptions, app);
server.listen(8080, () => { console.log("Server listening on port 8080"); });
Express does not support HTTP/2 (see #5462). The error caused by http2-express-bridge has been reported in the package's repository (rahulramesha/http2-express-bridge#11), but it looks like that project has not been updated in a long time and is abandoned by its author.
The function application.lazyrouter was removed with version 5 which the http2 bridge used to hook prototype overwriting for Http2ServerRequest and -Response on the req and res objects before forwarding them to the router api.
Since the application.router is now not accessible anymore before initialization and prototype overwriting happens in application.handle is there any other way to set Http2ServerRequest and -Response prototypes for req and res objects before application.router.handle is called?
Activity
krzysdz commentedon Jun 18, 2025
Express does not support HTTP/2 (see #5462). The error caused by
http2-express-bridgehas been reported in the package's repository (rahulramesha/http2-express-bridge#11), but it looks like that project has not been updated in a long time and is abandoned by its author.Thyran commentedon Jun 18, 2025
I think I found the cause of the error.
The function
application.lazyrouterwas removed with version 5 which the http2 bridge used to hook prototype overwriting for Http2ServerRequest and -Response on the req and res objects before forwarding them to the router api.Since the
application.routeris now not accessible anymore before initialization and prototype overwriting happens inapplication.handleis there any other way to set Http2ServerRequest and -Response prototypes for req and res objects beforeapplication.router.handleis called?