oven-sh/bun

`undici.Agent` is missing `async close()` method

オープン

#14,498 opened on 2024/10/12

 (3 件のコメント) (6 件のリアクション) (0 人の担当者)Rust (4,486 件のフォーク)batch import
bugconfirmed buggood first issue

Repository metrics

Stars
 (90,348 個のスター)
PR merge metrics
 (PR metrics pending)

説明

What version of Bun is running?

1.1.20+ae1948925

What platform is your computer?

Darwin 23.6.0 arm64 arm

What steps can reproduce the bug?

let Undici = await import("undici")
let agent = new Undici.Agent()
await agent.close()

What is the expected behavior?

On Node 22.9.0 - the last command returns null, no exceptions.

What do you see instead?

On Bun 1.1.20, agent.close is not implemented, so an exception is thrown (somehow crashing the REPL if using it).

> await agent.close()
2 | return await agent.close();;})();
                            ^
TypeError: agent.close is not a function. (In 'agent.close()', 'agent.close' is undefined)

Additional information

This is preventing NodeHttpClient.layerUndici from @effect/platform-node from working, as agent.close is used here:

https://github.com/Effect-TS/effect/blob/main/packages/platform-node/src/internal/httpClientUndici.ts#L27-L31

Thankfully the default client (NodeHttpClient.layer) works just fine as it uses node:http module under the hood.

コントリビューターガイド