@nestjs/common
12.5.1 · 16 Nov 2026MIT26M / weekRepositoryHomepagenpmAtom feed
In short
8 new30 fixed19 changed2 internal
Release note
Notable changes
New features
NestFactory.create()infers the application type from the adapter:NestFactory.create(AppModule, new FastifyAdapter())returns aNestFastifyApplicationwith no type argument, and the same goes forExpressAdapterandNodeAdapter. An explicit type argument still works. A custom adapter declares its application type as the fourth type argument ofAbstractHttpAdapter– #18623WsAdaptertakesgracefulShutdown(falseby default) andgracePeriod(10,000 ms by default). WithgracefulShutdown, closing the application stops accepting connections (an upgrade on a server shared with the HTTP adapter gets a 503), ignores new messages, waits up togracePeriodfor message handlers and pending replies, and closes each socket with code 1001 – #18589gRPC server:
gracePeriod(10,000 ms by default) forgracefulShutdown– #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 aftergracePeriodare now cancelled. RaisegracePeriodfor long-running streams – #18566A 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 – #18600A method that overrides a
@Res({ passthrough: true })handler with a plain@Res()no longer inheritspassthrough– #18617DiscoveryServicefinds a class that extends a class decorated with aDiscoveryService.createDecorator()decorator under that decorator – #18582Route conflict detection reads string hosts as patterns, so a route on
:tenant.example.comis found to overlap one onadmin.example.com, and such routes may now be reported – #18609The
createNestApplication()andcreateNestMicroservice()of a testing module applyloggerandforceConsoleasNestFactorydoes:logger: truekeeps the logger (it used to turn logging off), andforceConsole: truelogs throughconsole– #18618@nestjs/platform-node: aContent-Typeset withres.setHeader()getscharset=utf-8whenres.send()sends a string, as on Express – #18527@nestjs/platform-fastify: the exception for a failed upload carries the parser's error as itscause, 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), afterfind-my-way9.10.2; such a request used to reach the not-found handler – #18569inject()on@nestjs/platform-fastifyand@nestjs/platform-node: a response toHEAD, and a 204 or 304 response, has no body, afterlight-my-request6.8.1 – #18570
Microservices
NATS and MQTT servers closed before their client connects:
listen()fails with "Connection closed" instead of starting – #18602, #18603Clients 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 – #18535Gateways reject new clients as soon as the application starts closing – #18588
Dependencies
@nestjs/platform-fastify:@fastify/middie9.3.7,@fastify/cors11.4.3,@fastify/formbody9.0.2,find-my-way9.10.2,light-my-request6.8.1@nestjs/platform-node:@fastify/proxy-addr5.1.3,encodeurl2.0.3,find-my-way9.10.2,light-my-request6.8.1@nestjs/platform-ws:ws8.23.0
Features
microservices: feat(microservices): add a grace period to the grpc graceful shutdown (@mo74x)
platform-ws: feat(ws): add opt-in graceful shutdown to the ws adapter (@mo74x)
core, platform-express, platform-fastify, platform-node: feat(core,express,fastify,node): infer app type from adapter (@rafaself)
Bug fixes
common: fix(common): keep an overriding @Res() from inheriting passthrough (@mtnaskari)
common: fix(common): guard nested binary check against circular references (@MrSatan)
common: fix(common): redact map keys, skip array holes and guard flat params (@MrSatan)
common: fix(common): keep configurable module builder from mutating options (@yuvrajtiwary-bitmesraece)
common: fix(common): keep an optional leading group in normalize path (@rafay247)
common: fix(common): allow no options with extras in configurable module builder (@mo74x)
common: fix(common): copy own
__proto__keys of default values (@ragib-mrb)common: fix(common): preserve sparse array length in default value pipe (@Rio3210)
core: fix(core): match host patterns when detecting route conflicts (@Johannes7549)
core: fix(core): pass the response a custom decorator gives as it is (@kamilmysliwiec)
core: fix(core): discover providers that inherit a discovery decorator (@SudeepGowda55)
core: fix(core): preserve handler names on deferred routes (@mo74x)
core: fix(core): apply non-uri version filter once per multi-path route (@mo74x)
core: fix(core): keep the nest functions in the repl after ".clear" (@yuvrajtiwary-bitmesraece)
microservices: fix(microservices): stop mqtt server startup when closed before client connects (@ragib-mrb)
microservices: fix(microservices): stop nats server startup when closed before client connects (@ragib-mrb)
microservices: fix(microservices): stop a redis connection attempt once closed (@rafay247)
microservices: fix(microservices): evict pre-suback mqtt and redis requests on close (@mo74x)
microservices: fix(microservices): evict pending kafka requests on stop or rebalance (@mo74x)
microservices: fix(microservices): fail pending rmq requests on reply consumer cancel (@mo74x)
microservices: fix(microservices): stop an rmq connection attempt once the client is closed (@Asadshah7950)
microservices: fix(microservices): drain pending kafka replies before closing (@IbrahimHafez1)
platform-fastify: fix(fastify): clean up uploads of pipelined requests on close (@MrSatan)
platform-fastify: fix(fastify): keep the multipart error as the cause of 4xx (@prkomb)
platform-node: fix(node): preserve optional parameters in shared routes (@Rio3210)
platform-node: fix(node): add the charset to a content type set natively on send (@andreymudri)
testing: fix(testing): apply the logger and forceConsole options as NestFactory does (@mtnaskari)
websockets: fix(websockets): handle async exception filters in lifecycle hooks (@MrSatan)
websockets: fix(websockets): reject new clients on close and guard adapter dispose (@mo74x)
core, microservices: fix(core): resolve the context class through the class-ref registry (@micalevisk)
Enhancements
core: perf(core): reduce HTTP Observable response overhead (@MrSatan)
core: perf(core): build the interceptor chain without extra rxjs layers (@thekhegay)
platform-fastify: perf(fastify): fold the built-in request hooks into one (@thekhegay)
core, microservices, websockets: perf(core): resolve rpc, ws and external params without a promise (@thekhegay)
common, core, microservices, platform-express, platform-fastify, platform-node, testing, websockets: perf: re-export type-only modules with export type (@thekhegay)
A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.