Skip to content

v12.6.0

Latest

Choose a tag to compare

@kamilmysliwiec kamilmysliwiec released this 20 Nov 12:51
· 1 commit to master since this release
1e89004

v12.6.0 (2026-11-20)

Notable changes

New features

  • NestFactory.create() infers the application type from the adapter: NestFactory.create(AppModule, new FastifyAdapter()) returns a NestFastifyApplication with no type argument, and the same goes for ExpressAdapter and NodeAdapter. An explicit type argument still works. A custom adapter declares its application type as the fourth type argument of AbstractHttpAdapter – #18623
  • WsAdapter takes gracefulShutdown (false by default) and gracePeriod (10,000 ms by default). With gracefulShutdown, closing the application stops accepting connections (an upgrade on a server shared with the HTTP adapter gets a 503), ignores new messages, waits up to gracePeriod for message handlers and pending replies, and closes each socket with code 1001 – #18589
  • gRPC server: gracePeriod (10,000 ms by default) for gracefulShutdown – #18566

New defaults and behaviour changes

  • gRPC server with gracefulShutdown: closing used to wait for the calls in progress with no limit; calls still running after gracePeriod are now cancelled. Raise gracePeriod for long-running streams – #18566
  • A custom parameter decorator that gives the handler the response object now passes it as it is, and no pipe runs on it, as with @Res(), whatever the adapter. On Fastify such a handler used to never run – #18600
  • A method that overrides a @Res({ passthrough: true }) handler with a plain @Res() no longer inherits passthrough – #18617
  • DiscoveryService finds a class that extends a class decorated with a DiscoveryService.createDecorator() decorator under that decorator – #18582
  • Route conflict detection reads string hosts as patterns, so a route on :tenant.example.com is found to overlap one on admin.example.com, and such routes may now be reported – #18609
  • The createNestApplication() and createNestMicroservice() of a testing module apply logger and forceConsole as NestFactory does: logger: true keeps the logger (it used to turn logging off), and forceConsole: true logs through console – #18618
  • @nestjs/platform-node: a Content-Type set with res.setHeader() gets charset=utf-8 when res.send() sends a string, as on Express – #18527
  • @nestjs/platform-fastify: the exception for a failed upload carries the parser's error as its cause, as on Express – #18555
  • @nestjs/platform-fastify: the router answers a request whose target does not start with / (other than * and absolute-form URLs) with a 400 (FST_ERR_BAD_URL), after find-my-way 9.10.2; such a request used to reach the not-found handler – #18569
  • inject() on @nestjs/platform-fastify and @nestjs/platform-node: a response to HEAD, and a 204 or 304 response, has no body, after light-my-request 6.8.1 – #18570

Microservices

  • NATS and MQTT servers closed before their client connects: listen() fails with "Connection closed" instead of starting – #18602, #18603
  • Clients fail pending requests with "Connection closed" where they used to leave them waiting: Kafka when the reply consumer stops or crashes, or a rebalance moves its reply partition away – #18583; MQTT and Redis when closed before the reply subscription is confirmed – #18584; RabbitMQ when the broker cancels the direct reply-to consumer – #18585
  • Kafka server: closing waits for the replies in progress, for gracePeriod (10 s by default) at most, after the consumer disconnects – #18535
  • Gateways reject new clients as soon as the application starts closing – #18588

Dependencies

  • @nestjs/platform-fastify: @fastify/middie 9.3.7, @fastify/cors 11.4.3, @fastify/formbody 9.0.2, find-my-way 9.10.2, light-my-request 6.8.1
  • @nestjs/platform-node: @fastify/proxy-addr 5.1.3, encodeurl 2.0.3, find-my-way 9.10.2, light-my-request 6.8.1
  • @nestjs/platform-ws: ws 8.23.0

Features

  • microservices
    • #18566 feat(microservices): add a grace period to the grpc graceful shutdown (@mo74x)
  • platform-ws
    • #18589 feat(ws): add opt-in graceful shutdown to the ws adapter (@mo74x)
  • core, platform-express, platform-fastify, platform-node
    • #18623 feat(core,express,fastify,node): infer app type from adapter (@rafaself)

Bug fixes

  • common
    • #18617 fix(common): keep an overriding @res() from inheriting passthrough (@mtnaskari)
    • #18612 fix(common): guard nested binary check against circular references (@MrSatan)
    • #18598 fix(common): redact map keys, skip array holes and guard flat params (@MrSatan)
    • #18597 fix(common): keep configurable module builder from mutating options (@yuvrajtiwary-bitmesraece)
    • #18579 fix(common): keep an optional leading group in normalize path (@rafay247)
    • #18571 fix(common): allow no options with extras in configurable module builder (@mo74x)
    • #18574 fix(common): copy own __proto__ keys of default values (@ragib-mrb)
    • #18551 fix(common): preserve sparse array length in default value pipe (@Rio3210)
  • core
  • microservices
    • #18603 fix(microservices): stop mqtt server startup when closed before client connects (@ragib-mrb)
    • #18602 fix(microservices): stop nats server startup when closed before client connects (@ragib-mrb)
    • #18594 fix(microservices): stop a redis connection attempt once closed (@rafay247)
    • #18584 fix(microservices): evict pre-suback mqtt and redis requests on close (@mo74x)
    • #18583 fix(microservices): evict pending kafka requests on stop or rebalance (@mo74x)
    • #18585 fix(microservices): fail pending rmq requests on reply consumer cancel (@mo74x)
    • #18545 fix(microservices): stop an rmq connection attempt once the client is closed (@Asadshah7950)
    • #18535 fix(microservices): drain pending kafka replies before closing (@IbrahimHafez1)
  • platform-fastify
    • #18596 fix(fastify): clean up uploads of pipelined requests on close (@MrSatan)
    • #18555 fix(fastify): keep the multipart error as the cause of 4xx (@prkomb)
  • platform-node
    • #18611 fix(node): preserve optional parameters in shared routes (@Rio3210)
    • #18527 fix(node): add the charset to a content type set natively on send (@andreymudri)
  • testing
    • #18618 fix(testing): apply the logger and forceConsole options as NestFactory does (@mtnaskari)
  • websockets
    • #18595 fix(websockets): handle async exception filters in lifecycle hooks (@MrSatan)
    • #18588 fix(websockets): reject new clients on close and guard adapter dispose (@mo74x)
  • core, microservices
    • #18517 fix(core): resolve the context class through the class-ref registry (@micalevisk)

Enhancements

  • core
    • #18607 perf(core): reduce HTTP Observable response overhead (@MrSatan)
    • #18593 perf(core): build the interceptor chain without extra rxjs layers (@thekhegay)
  • platform-fastify
  • core, microservices, websockets
    • #18559 perf(core): resolve rpc, ws and external params without a promise (@thekhegay)
  • common, core, microservices, platform-express, platform-fastify, platform-node, testing, websockets

Docs

  • common
  • common, core, microservices, platform-express, platform-fastify, platform-node, platform-socket.io, platform-ws, testing, websockets

Committers: 20