denoland / deno

A modern runtime for JavaScript and TypeScript.
https://deno.com
MIT License
93.95k stars 5.23k forks source link

bug(net): http2 protocol error since deno 1.45 #24606

Open JOTSR opened 1 month ago

JOTSR commented 1 month ago

Version: Deno 1.45.x

Description

Getting HTTP2 error due to broken body in a deno fresh project. No log or errors are visible through deno process. No problem before deno@1.45.0 not included.

To reproduce

Seen on this project https://git.cohabit.fr/cohabit/website

Requirements

To run without https self-signed, comment:

git clone https://git.cohabit.fr/cohabit/website
cd website
deno task start

Logs

Log in chrome

GET http://localhost:8000/ net::ERR_INCOMPLETE_CHUNKED_ENCODING 200 (OK) Failed to load resource: net::ERR_HTTP2_PROTOCOL_ERROR

From repl

Deno 1.45.1
exit using ctrl+d, ctrl+c, or close()
> await fetch('http://localhost:8000')
Response {
  body: ReadableStream { locked: false },
  bodyUsed: false,
  headers: Headers {
    "content-type": "text/plain; charset=utf-8",
    date: "Tue, 16 Jul 2024 13:40:26 GMT",
    "set-cookie": "__Host-CSRF=77e2a74a-ab23-4de3-a895-18d29799c5e1; Secure; SameSite=Strict; Path=/; Expires=Tue, 16 Jul 2024 14:10:26 GMT",
    "transfer-encoding": "chunked",
    vary: "Accept-Encoding"
  },
  ok: true,
  redirected: false,
  status: 200,
  statusText: "OK",
  url: "http://localhost:8000/"
}
> await fetch('http://localhost:8000').then(r => r.text())
Uncaught TypeError: error decoding response body
    at async readableStreamCollectIntoUint8Array (ext:deno_web/06_streams.js:1065:19)
    at async consumeBody (ext:deno_fetch/22_body.js:241:9)
    at async <anonymous>:1:22
> await fetch('http://localhost:8000').then(r => r.bytes())
Uncaught TypeError: error decoding response body
    at async readableStreamCollectIntoUint8Array (ext:deno_web/06_streams.js:1065:19)
    at async consumeBody (ext:deno_fetch/22_body.js:241:9)
    at async <anonymous>:1:22
>
lucacasonato commented 1 month ago

I tried to reproduce your issue, and I am seeing the following:

I am wondering if there is something special you are doing in your code here?