Dark Mode

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

express crashing when using node internal http2 module on sending any request from client #6583

Thyran started this conversation in General
express crashing when using node internal http2 module on sending any request from client #6583
Jun 18, 2025 * 2 comments * 1 reply
Return to top
Discussion options

Thyran
Jun 18, 2025

Environment information

Version: 5.*

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.js version:
Linux: 23.11, 24.2
Windows: 22.12

Any other relevant information:
Error code:

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?

  1. Install express and http2-express-bridge dependency with npm
  2. Generate ssl key and cert file with openssl directly or using wsl
  3. 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"); });
  1. Add index.mjs as main script in package.json
  2. Run with node .
  3. Navigate to https://localhost:8080 in browser
You must be logged in to vote

Replies: 2 comments 1 reply

Comment options

krzysdz
Jun 18, 2025
Collaborator

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.

You must be logged in to vote
0 replies
Comment options

Thyran
Jun 18, 2025
Author

I think I found the cause of the error.

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?

You must be logged in to vote
1 reply
Comment options

yackinn Aug 7, 2025

Did you find any solution?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
General
Labels
3 participants
Converted from issue

This discussion was converted from issue #6580 on June 21, 2025 01:00.