Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Typed unix socket and TLS options for `BunHttpClient` and `DenoHttpClient`

オープン
#9,687 コメント 0 件 リアクション 0 件 担当者 1 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@effect-bot がすでに取り組んでいます。

2026年10月21日 から。

  • #9704 @tim-smart による — オープン

評価

この issue はまだ評価されていません。

説明

docker-made-me-do-it enhancement platform

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 from Deno.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 fetch that injects client with as any and 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.HttpClient in 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:

  • layerOptions for 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 を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

Effect-TS/effect のほかの issue

Effect-TS/effect の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。