hono icon indicating copy to clipboard operation
hono copied to clipboard

Return a piped response with compression enabled causes an unexpected error

Open ceifa opened this issue 1 year ago • 1 comments

What version of Hono are you using?

4.5.8

What runtime/platform is your app running on?

Node

What steps can reproduce the bug?

Enable the built-in compression:

app.use(compress());

Inside a hono route, do the following:

return await fetch(targetUrl, {
    method: req.method,
    headers,
    body: req.raw.body,
    duplex: 'half',
});

What is the expected behavior?

Response piped correctly.

What do you see instead?

TypeError: immutable at _Headers.delete (node:internal/deps/undici/undici:3303:17) at set res [as res] (file:///D:/whitewall/proxy/node_modules/hono/dist/context.js:62:31) at compress2 (file:///D:/whitewall/proxy/node_modules/hono/dist/middleware/compress/index.js:12:13)

Additional information

It works on latest version of 3.x. Stopped in 4.x.

ceifa avatar Aug 23 '24 13:08 ceifa

Edited

nitedani avatar Aug 23 '24 18:08 nitedani

This was closed by https://github.com/honojs/hono/pull/3318. Thanks.

yusukebe avatar Sep 29 '24 10:09 yusukebe