Typed unix socket and TLS options for `BunHttpClient` and `DenoHttpClient`
メンテナーはふだん 1 日以内に返信
評価
この issue はまだ評価されていません。
説明
Problem
NodeHttpClient has typed layers for connecting over a unix socket and for custom TLS (#9158):
NodeHttpClient.layerUndiciOptions({ connect: { socketPath: "/var/run/docker.sock" } })
NodeHttpClient.layerUndiciOptions({ connect: { ca, cert, key, servername } })
Bun and Deno have nothing equivalent: BunHttpClient and DenoHttpClient only re-export FetchHttpClient. Both runtimes can do the same things, but only through fetch fields that aren't in the standard RequestInit:
- Bun:
fetch(url, { unix, tls: { ca, cert, key, rejectUnauthorized, serverName } }) - Deno:
fetch(url, { client }), where the client comes fromDeno.createHttpClient({ caCerts, cert, key, proxy: { transport: "unix", path } })and has to be closed afterwards.
You can get there by providing FetchHttpClient.RequestInit or a custom Fetch, but it isn't documented, and the types don't fit. Effect's own Kubernetes integration, which only needs to trust one CA file, does it three different ways:
- Node: an undici
Agent(packages/platform/node/src/NodeClusterSocket.ts:150-174). - Bun:
{ tls: { ca } } as any(packages/platform/bun/src/BunClusterSocket.ts:156-160). - Deno: a wrapped
fetchthat injectsclientwithas anyand closes it when the scope ends (packages/platform/deno/src/DenoClusterSocket.ts:197-201).
Anyone who needs the Docker socket on Bun, or a client certificate on Deno, has to rediscover all of this.
Proposal
One layer per runtime that takes that runtime's own options, the same way the Node layers take undici's options:
BunHttpClient.layerOptions({ unix: "/var/run/docker.sock" })
BunHttpClient.layerOptions({ tls: { ca, cert, key } })
DenoHttpClient.layerOptions({ proxy: { transport: "unix", path: "/var/run/docker.sock" } })
DenoHttpClient.layerOptions({ caCerts: [ca], cert, key })
- Bun passes the options into every fetch call.
- Deno creates the
Deno.HttpClientin the layer's scope and closes it when the scope ends. - The JSDoc for each layer says what is supported. For example, Deno has no option to skip certificate verification or to set the server name.
Then switch the Bun and Deno Kubernetes layers over and remove the casts.
Why in Effect
HttpClient is meant to be portable, yet on two of the three server runtimes these settings are only reachable through untyped, undocumented fields. This is the Node change from #9158 applied to Bun and Deno, with no new concepts.
Scope
In scope:
layerOptionsfor Bun and Deno, with docs.- Using them in the Kubernetes layers.
Out of scope:
- A connection or TLS type shared by all runtimes.
http+unix://URLs, which have no standard scheme.- Per-request connection settings.
- 主要言語
- TypeScript
- スター
- 16.7k
- フォーク
- 808
- 平均マージ
- 10時間 7分
- マージ済み PR(30日)
- 808
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
Effect-TS/effect のほかの issue
-
Support {self: this} for fnUntraced対応中かも @ArjunCodess が 32 日前に担当しました。 オープンenhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
Effect-TS/effect#8101 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
v4 Cache.get: a caller that joins an abandoned lookup fails with an interruption it did not ask forオープン
難易度 4/5 3〜5日 初心者へのやさしさ 42/100
メンテナーはふだん 1 日以内に返信
-
RFC 9457 Problem Details for HttpApi errors対応中かも @effect-bot が今日担当しました。 オープンdocker-made-me-do-it enhancement
難易度 5/5 1週間以上 初心者へのやさしさ 20/100
メンテナーはふだん 1 日以内に返信
-
Typed parsers and formatters for common HTTP header values対応中かも @effect-bot が 1 日前に担当しました。 オープンdocker-made-me-do-it enhancement
Effect-TS/effect#9685 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
Effect-TS/effect の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
chaitin/MonkeyCode#1437 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 69/100
carbon-design-system/carbon-ai-chat#2615 ·
メンテナーはふだん 1 日以内に返信
-
e2e-failure ready-to-code
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
redhat-developer/rhdh-plugin-export-overlays#4486 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
[Bug]: fileUploadMatrix.test.ts URL case does a real DNS lookup and fails offline対応中かも @r2jaff が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
ComposioHQ/composio#5054 ·
メンテナーはふだん 1 日以内に返信