Repository navigation
fix(nestjs-trpc): Support the NodeAdapter from @nestjs/platform-node - #134
Merged
Merged
Conversation
Bun's native test runner enforces that value imports exist at runtime, so importing the type-only TRPCModuleOptions as a value made it refuse to load two spec files.
The config/ directory was removed in ed28eb8 but the build script kept compiling config/tsconfig.json, so bun run build always failed after the dist compile. Also syncs bun.lock with the NestJS 12 peer ranges already in package.json.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
NodeAdapter.getType() returns 'node', which the platform dispatch rejected. A dedicated NodeDriver now serves it through tRPC's native node-http adapter, handing the router's raw req/res straight to nodeHTTPRequestHandler - the same wiring a hand-rolled Node HTTP server would use. The node router strips the mount prefix connect-style, so the remaining pathname is the procedure path. The adapter options union hoists middleware out of the per-adapter variants and types it once against the native request: each adapter spelled its own request type there, which made the union unusable by any one of them. Closes #133
KevinEdry
force-pushed
the
fix/node-adapter-support
branch
from
November 12, 2026 18:16
766dc8e to
c97ba40
Compare
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TRPCModule.forRoot()throwsUnsupported http adapter: nodeon theNodeAdapterfrom@nestjs/platform-node(NestJS 12.4+), so tRPC can never initialize on that platform.A new
NodeDriverserves it through tRPC's native node-http adapter. It mounts a handler on the node router and passes the raw request and response tonodeHTTPRequestHandler, the same wiring a hand-rolled Node HTTP server uses. The node router strips the mount prefix connect-style, so the remaining pathname is the procedure path. The driver matches the router structurally, and the package takes no dependency on@nestjs/platform-node.The adapter options union now hoists
middlewareout of the per-adapter variants and types it once against the native request. Each adapter spelled its own request type there, which made the union unusable by any one of them.Two pre-existing fixes ride along in their own commits:
TRPCModuleOptionswas imported as a value, which bun's native test runner rejects when loading two spec files.config/directory, sobun run buildalways failed after the dist compile.Verified against the packed tarball: queries and mutations answer on
@nestjs/platform-node@12.4.2, and the Express and Fastify probes still pass.Closes #133