Skip to main content

NestJS 12.6.0

Release Date: November 20, 2026

NestJS 12.6.0 was published on November 20, 2026, the first minor release on the 12.x line since 12.5.1 four days earlier. The release adds adapter-driven type inference to NestFactory.create(), opt-in graceful shutdown for the WebSocket adapter, and a bounded grace period for gRPC shutdown, alongside a large batch of connection-lifecycle fixes across the Kafka, MQTT, Redis, RabbitMQ and NATS transports. Twenty contributors are credited in the release notes.

What Changed

Three features headline the changelog. The first is convenience for typed applications: NestFactory.create(AppModule, new FastifyAdapter()) now returns a NestFastifyApplication without passing the type argument by hand. The same applies to ExpressAdapter and NodeAdapter, and an explicit type argument still compiles. Custom adapters opt in by declaring their application type as the fourth type argument of AbstractHttpAdapter (PR #18623).

The second is shutdown control for WebSockets. WsAdapter accepts gracefulShutdown, off by default, and gracePeriod, which defaults to 10,000 ms. When enabled, closing the application stops accepting connections (an upgrade request arriving on a server shared with the HTTP adapter gets a 503), ignores new messages, waits up to the grace period for message handlers and pending replies, and closes each socket with code 1001 (PR #18589).

The third is a behaviour change to gRPC shutdown. The gRPC server's graceful shutdown now honours a gracePeriod of 10,000 ms by default. Previously, closing waited indefinitely for in-flight calls. Calls still running when the period expires are now cancelled, so long-running streams need an explicit, larger value (PR #18566).

Shutdown and Connection Lifecycle

The bulk of the release sits in the microservices package, and the theme is uniform: operations that were silently left waiting now fail with a clear "Connection closed" error.

  • Kafka clients evict pending requests when the reply consumer stops or crashes, or when a rebalance moves the reply partition away (PR #18583).
  • MQTT and Redis clients evict requests that were pending before the reply subscription was confirmed (PR #18584), and RabbitMQ fails them when the broker cancels the direct reply-to consumer (PR #18585).
  • NATS and MQTT servers that are closed before their client connects no longer start; listen() fails with "Connection closed" (PRs #18602, #18603).
  • The Kafka server drains replies in progress for up to the grace period, 10 seconds by default, after the consumer disconnects (PR #18535).
  • Gateways reject new clients as soon as the application begins closing (PR #18588), and earlier Redis and RabbitMQ connection attempts stop once the client is closed (PRs #18594, #18545).

Why It Matters

Two changes in the core package can alter existing behaviour rather than only fixing bugs. Route conflict detection now reads string hosts as patterns, so a route registered on :tenant.example.com is recognised as overlapping one on admin.example.com and may be reported at startup (PR #18609). Applications with decorative host wildcards will see new diagnostics.

The response-object convention is also tightened. A custom parameter decorator that hands the handler the response object now passes it through as it is, with no pipe running on it, matching @Res() on every adapter. On Fastify, such a handler used to never run at all (PR #18600). A method that overrides a @Res({ passthrough: true }) handler with a plain @Res() no longer inherits the passthrough flag (PR #18617).

Elsewhere, DiscoveryService now finds a class that extends a class carrying a DiscoveryService.createDecorator() decorator (PR #18582), and the testing module's createNestApplication() and createNestMicroservice() apply logger and forceConsole the way NestFactory does. Note that logger: true now keeps the logger instead of turning logging off (PR #18618).

Platform Fixes and Dependencies

On @nestjs/platform-node, a Content-Type written with res.setHeader() gains charset=utf-8 when res.send() sends a string, matching Express (PR #18527). On @nestjs/platform-fastify, a failed upload carries the parser error as its cause (PR #18555), a request target that does not start with a slash now returns a 400 with FST_ERR_BAD_URL after the move to find-my-way 9.10.2 (PR #18569), and responses to HEAD or with status 204 and 304 carry no body after light-my-request 6.8.1 (PR #18570).

Bundled dependency updates include @fastify/middie 9.3.7, @fastify/cors 11.4.3 and @fastify/formbody 9.0.2 for the Fastify platform, encodeurl 2.0.3 for the Node platform, and ws 8.23.0 for the WebSocket platform.

What's Next

Install with npm install @nestjs/[email protected] and align the platform packages. Teams running WebSockets or gRPC in Kubernetes should review shutdown hooks before enabling the new flags, since the grace period now bounds how long a pod drains. The full comparison against 12.5.1 is available in the repository's release notes.

Other Versions

We use cookies for ads and analytics.