Skip to content

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

@Thyran

Description

@Thyran

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions