Typed unix socket and TLS options for `BunHttpClient` and `DenoHttpClient`
I maintainer di solito rispondono entro 1 giorno
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
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.
- Lingua principale
- TypeScript
- Stelle
- 16.7k
- Fork
- 808
- Merge medio
- 10h 7m
- PR unite (30g)
- 808
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di Effect-TS/effect
-
Support {self: this} for fnUntracedForse già presa @ArjunCodess l’ha presa 32 giorni fa. Apertaenhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
Effect-TS/effect#8101 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
v4 Cache.get: a caller that joins an abandoned lookup fails with an interruption it did not ask forAperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 42/100
I maintainer di solito rispondono entro 1 giorno
-
RFC 9457 Problem Details for HttpApi errorsForse già presa @effect-bot l’ha presa oggi. Apertadocker-made-me-do-it enhancement
Difficoltà 5/5 Più di una settimana Idoneità per principianti 20/100
I maintainer di solito rispondono entro 1 giorno
-
Typed parsers and formatters for common HTTP header valuesForse già presa @effect-bot l’ha presa oggi. Apertadocker-made-me-do-it enhancement
Effect-TS/effect#9685 · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di Effect-TS/effect
Issue simili
-
agent/scanner help wanted hive/claimed-by-scanner kind/bug stage/020-claimed
Difficoltà 2/5 1-3 ore Idoneità per principianti 90/100
hivecommons/rationguard#315 ·
I maintainer di solito rispondono entro 1 giorno
-
agent-ready area: ui-sdk priority: p3 type: chore
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
schlessera/brain-kit#2534 ·
I maintainer di solito rispondono entro 1 giorno
-
bug lane:gh-5
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
LLM-4-People/bridlewise-testing#122 ·
I maintainer di solito rispondono entro 1 giorno
-
bug priority: P2
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
enhancement priority:low ready-for-dev
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
I maintainer di solito rispondono entro 1 giorno