Skip to content

node:http2 module is missing named exports (Http2ServerRequest, Http2ServerResponse, constants) #1651

Description

@proggeramlug

Scope

Perry implements http2.createSecureServer({...}, handler) natively (per #577 Phase 3 closure summary, commit c9667b2 v0.5.691) — that path works. But the node:http2 JS module namespace is missing the named exports that Node-ecosystem packages (notably @hono/node-server) import directly. The class instances flow through the handler callback correctly; they just aren't reachable as standalone module exports.

Why

@hono/node-server — Hono's official Node adapter, ~200 lines of TS that "works unchanged against any compliant node:http host" (per #577 issue body) — opens with:

```typescript
import { STATUS_CODES, createServer } from "node:http";
import { Http2ServerRequest, constants } from "node:http2";
import { Readable } from "node:stream";
```

Under Perry-native compile the load fails:

```
[js_load_module] FAILED to load `@hono/node-server/dist/index.mjs`:
Uncaught SyntaxError: The requested module 'http2' does not provide an
export named 'Http2ServerRequest'
```

That's both @hono/node-server@1.19.14 (current pin) and the latest @2.0.3 — Hono didn't change the import; Perry just doesn't expose the export.

Even though @hono/perry-server (proposed separately) will be the preferred adapter, @hono/node-server working unchanged is the promise of #577 — and a number of Node frameworks (Express, Koa, Polka, h3) reach for the same http2 symbols.

Repro (Perry 0.5.1026, perry-src commit f46c4c3)

```typescript
import { Http2ServerRequest, Http2ServerResponse, constants, createSecureServer } from 'node:http2';
console.log(typeof createSecureServer); // expected: function ; observed: function ✅
console.log(typeof Http2ServerRequest); // expected: function ; observed: import fails
console.log(typeof Http2ServerResponse); // expected: function ; observed: import fails
console.log(typeof constants); // expected: object ; observed: import fails
```

The import itself errors before any `console.log` runs.

Acceptance

  • import { Http2ServerRequest, Http2ServerResponse, constants } from 'node:http2' succeeds under Perry-native compile.
  • @hono/node-server's import { Http2ServerRequest, constants as h2constants } from "http2" (line 8 of its compiled dist/index.mjs) loads cleanly. CI smoke: a five-line Hono app.fetch registered with serve() from @hono/node-server listens and serves curl /healthz end-to-end.
  • Same audit pass for node:http and node:https named exports while you're in there — drift here will be invisible until somebody else's npm import line hits it.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions