Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing maxHeaderSize breaks Undici #23432

Closed
lukahartwig opened this issue Apr 18, 2024 · 0 comments · Fixed by #23479
Closed

Missing maxHeaderSize breaks Undici #23432

lukahartwig opened this issue Apr 18, 2024 · 0 comments · Fixed by #23479
Labels
bug Something isn't working node API polyfill Related to various "node:*" modules APIs node compat

Comments

@lukahartwig
Copy link
Contributor

Version: Deno 1.42.2

Using Undici fetch breaks in Deno due to an incompatibility with node:http.

Example

// main.ts
import { fetch } from "npm:undici";
const response = await fetch("https://www.google.com");
console.log("response", response);

Output

deno run -A main.ts

error: Uncaught (in promise) TypeError: fetch failed
    at fetch (file:///Users/lukahartwig/Library/Caches/deno/npm/registry.npmjs.org/undici/6.13.0/index.js:109:13)
    at eventLoopTick (ext:core/01_core.js:168:7)
    at async file:///Users/lukahartwig/repos/deno-blob/main.ts:3:18
Caused by: AssertionError
    at new AssertionError (ext:deno_node/assertion_error.ts:414:11)
    at toNode (node:assert:44:15)
    at assert (node:assert:61:3)
    at new Parser (file:///Users/lukahartwig/Library/Caches/deno/npm/registry.npmjs.org/undici/6.13.0/lib/dispatcher/client-h1.js:140:5)
    at connectH1 (file:///Users/lukahartwig/Library/Caches/deno/npm/registry.npmjs.org/undici/6.13.0/lib/dispatcher/client-h1.js:646:21)
    at eventLoopTick (ext:core/01_core.js:168:7)
    at async connect (file:///Users/lukahartwig/Library/Caches/deno/npm/registry.npmjs.org/undici/6.13.0/lib/dispatcher/client.js:449:11)

The issue seems to be that Undici asserts maxHeaderSize from node:http which is not defined in Deno.

import http from "node:http";

console.log(http.maxHeaderSize);
// Node -> 16384
// Bun -> 16384
// Deno -> undefined
@lukahartwig lukahartwig changed the title Missing maxHeaderSize breaks undici Missing maxHeaderSize breaks Undici Apr 18, 2024
@bartlomieju bartlomieju added bug Something isn't working node compat node API polyfill Related to various "node:*" modules APIs labels Apr 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working node API polyfill Related to various "node:*" modules APIs node compat
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants