Question
tRPC HTTP Client and Node.js Agent Configuration Interoperability
Ash Byte
0 reputation · 21 Jun 2021, 01:50 UTC
114.7K views0
Integration Goal
Determine whether tRPC should expose a user‑configurable hook for the underlying HTTP Agent (or undici fetch pool) while preserving the generic client abstraction that works across Node.js versions.
The challenge lies in balancing backward compatibility, version‑specific defaults (legacy http.Agent vs undici), and ensuring that any Agent replacement does not affect in‑flight requests or create mixed pool configurations.
Questions:
- Should tRPC add an
agentFactory(or similar) option tocreateHTTPClientOptionsthat lets users supply a custom Agent or fetch implementation? - How would this option interact with the existing generic client abstraction without leaking transport details?
- What default behavior should be applied for Node ≥ 18 (undici) versus earlier Node versions to maintain consistency?