NestJS 12.5.0
NestJS 12.5.0 shipped on November 12, 2026, and the release reads like a hardening pass. The framework now puts explicit ceilings on the message sizes, concurrency, and buffer sizes that its WebSocket, microservice, and HTTP adapters accept, and it fails loudly at startup when a guard, interceptor, pipe, or middleware target cannot actually run. Kamil Mysliwiec authored the bulk of the changes, with contributions from six other committers in the 12.5.0 changelog.
What Changed
The new options are all about bounding work a client or peer can ask for:
- WebSocket payload cap.
WsAdaptertakesmaxPayload, the largest message a client may send. The default is now 1 MB, down from 100 MB. A gateway's ownmaxPayloadtakes precedence,0lifts the limit, and a larger message closes the connection with code 1009. The same cap applies toplatform-wsandplatform-socket.io. - Queued WebSocket messages.
IoAdaptertakesmaxWaitingMessages, the number of a client's messages for one event that may wait beyond those already being handled: 10,000 by default,Infinityto lift it. - TCP throughput ceilings. The TCP server accepts
maxConcurrentMessages, 1000 per connection by default, with0to lift it. - gRPC backpressure. The gRPC server takes
maxPendingResponses, 1000 by default. Past that, a streaming call whose client leaves its responses unread fails withRESOURCE_EXHAUSTED.0disables the check. - Redis wildcard replies.
maxWildcardChannelLengthlimits the channel length for requests matched through a wildcard subscription, 1024 characters by default. - RabbitMQ message size.
maxMessageSizecaps messages and replies decoded as JSON at 16 MiB. - Fastify JSON fields.
@nestjs/platform-fastifygainslimits.jsonFieldsSize, 1 MiB by default, for the fields of a multipart request sent asapplication/json.
Several defaults moved as well. TCP maxBufferSize drops to 16 Mi characters from 128 Mi, and it is now applied to each packet rather than to everything received in one read, so a burst of small packets no longer closes a connection (issue #18502). A TCP server with an empty or unset host now listens on localhost only; set host: '0.0.0.0' or '::' to bind every interface. Multipart requests on platform-express and platform-node are capped at 1000 parts by default, which also caps a fields, files, or maxCount above that unless limits.parts is raised. An upload option a route sets to undefined or null now keeps the module value, and a limit passed as NaN (a common result of Number(process.env.UNSET)) gets its default instead of silently disabling the limit.
Why It Matters
The 100 MB to 1 MB WebSocket default and the multipart part cap are the two changes most likely to surface in production. A client that pushes large binary frames will start seeing close code 1009, and a multipart handler that accepts more than 1000 parts now needs an explicit limit. The TCP buffer change cuts memory per connection by an order of magnitude, which is good news for services that fan out many connections, but the per-packet semantics mean a misconfigured read loop behaves differently than it did on 12.3.x.
Startup validation is the other shift. A guard, interceptor, or pipe that cannot run, such as an abstract class used as a token or a class passed as the useValue of APP_GUARD, now fails the application at startup instead of failing per request. An exception filter that cannot run logs a warning. An invalid forRoutes() or exclude() entry fails startup. So does a gateway that joins a shared server with a verifyClient or allowRequest the server will not run, or gateways on one port that declare different hosts. On Fastify, declaring @All('x') above @Search('x') or a WebDAV method on the same path now fails at startup, matching the rule that already applied in reverse order.
Streaming and Scoping Fixes
ClassSerializerInterceptor and StandardSchemaSerializerInterceptor now serialize each object a streamed HTTP response yields, so @Exclude(), serializer groups, and standard schemas apply to every line of NDJSON rather than only the first. @Sse() writes a : comment every 5 seconds while Node.js has paused a client's socket, which lets the server notice a client that left.
Route matching got a set of corrections. Middleware given to forRoutes() is mounted where the router actually serves the covered routes, including routes excluded from the global prefix. Parameter pipes of controllers built with mixins, or wrapped by a class decorator that returns a Proxy, now run. On platform-node, a matched route that would leave a route parameter empty answers 404, and // matches the pattern of a root optional group route the way Express does. The exclude predicate of enableCsrfProtection() now excludes a request only when it returns true.
Microservice transports were also tightened. Kafka events can no longer request a reply through reply headers, an object carrying a key or value plus other properties is sent as the payload, and a reply topic the server handles itself is dropped. RabbitMQ wildcard routing no longer handles a message whose pattern names a different handler than its routing key. Patterns with a string value over 4096 characters or more than 100 keys get a marker route, and multi-key patterns with non-ASCII keys may get a new route, so clients and servers using such patterns should run the same version. An @Optional() dependency that exists but fails to build now fails its consumer, transient providers with durable dependencies are built per request, and moduleRef.create() rejects a request-scoped property dependency just as it does for constructor parameters.
Upgrade Notes
- Update
@nestjs/coreand the platform packages together. The adapters pass new route matching options to core. - Audit any WebSocket gateway that expects frames above 1 MB and set
maxPayloadexplicitly on the adapter or gateway. - Check multipart handlers that accept more than 1000 parts, and raise
limits.partsif needed. - Replace limit values derived from unset environment variables.
NaNnow falls back to the default instead of disabling the limit. - Expect startup failures for enhancer tokens,
forRoutes()targets, and gateway connection checks that previously failed silently at request time.
Install with npm install @nestjs/[email protected] alongside the matching platform package, and run the test suite before deploying: the startup validation changes are the most likely source of surprises in CI.