Packages

@nestjs/platform-node

12.5.1 · 16 Nov 2026MIT60.7k / weekRepositoryHomepagenpmAtom feed

Your version

12.5.0

12 Nov 2026Where it was published

12.5.1 is the newest release of 12.x.

In short

10 breaking17 fixed1 internal

  • Breaking

    @nestjs/platform-fastify: multipart limits.jsonFieldsSize (1 MiB by default) for the fields of a request sent as application/json

  • Breaking

    An upload option a route sets to undefined or null now keeps the module's value; use Infinity to lift a limit

  • Breaking

    ClassSerializerInterceptor and StandardSchemaSerializerInterceptor serialize each object a streamed HTTP response yields, so @Exclude(), groups and schemas apply to every line of NDJSON

    To check
  • Breaking

    Middleware given to forRoutes() is mounted where the router serves the routes it covers, including routes excluded from the global prefix

    To check
  • Breaking

    Parameter pipes of controllers built with mixins or wrapped by a class decorator that returns a Proxy now run

    To check
  • Breaking

    @nestjs/platform-fastify: @All('x') declared above @Search('x') or a WebDAV method on the same path fails at startup, as the reverse order already did; @All() routes now also answer these methods

  • Breaking

    @nestjs/core and the platform packages should be updated together, as the adapters pass new route matching options to core.

  • Breaking

    platform-node: fix(node): map only client syntax and uri errors to 400

Release note

Notable changes

New options

  • WsAdapter takes maxPayload, the largest message a client may send (1 MB by default, was 100 MB; a gateway's own maxPayload takes precedence, 0 lifts the limit); a larger message closes the connection with code 1009 – 109e52cd9b

  • IoAdapter takes maxWaitingMessages, the number of a client's messages of one event that may wait beyond those being handled (10,000 by default; Infinity lifts it) – c98b5f782e

  • TCP server: maxConcurrentMessages (1000 per connection by default; 0 lifts it) – 42c619cd69

  • gRPC server: maxPendingResponses (1000 by default; 0 disables), after which a streaming call whose client leaves its responses unread fails with RESOURCE_EXHAUSTED – ce6d44d858

  • Redis server: maxWildcardChannelLength (1024 characters by default; 0 disables) for requests matched through a wildcard subscription – 074dcf7c60

  • RabbitMQ: maxMessageSize (16 MiB by default) for messages and replies decoded as JSON – da6b3fc5bc

  • @nestjs/platform-fastify: multipart limits.jsonFieldsSize (1 MiB by default) for the fields of a request sent as application/json – 958316696f

New defaults and behaviour changes

  • TCP: maxBufferSize defaults to 16 Mi characters (was 128 Mi), in both directions – 55da0b0d33 – and now applies to each packet rather than to everything received in one read, so a burst of small packets no longer closes the connection (#18502) – ce285e6ad3

  • TCP server: an empty or unset host now listens on localhost; set host: '0.0.0.0' (or '::') to listen on every interface – 4196d3655d

  • @nestjs/platform-express, @nestjs/platform-node: multipart requests default to at most 1000 parts, which also caps a fields, files or maxCount above 1000 unless limits.parts is raised – b2bbc17122

  • An upload option a route sets to undefined or null now keeps the module's value; use Infinity to lift a limit – 7bc8d9121e

  • A limit option given as NaN (e.g. Number(process.env.UNSET)) now gets its default instead of turning the limit off, for TCP, Kafka, WsAdapter, IoAdapter, the validation pipes and @Sse() – 8209d1c8be, f956177a0e, 5b58a6e89f

  • ClassSerializerInterceptor and StandardSchemaSerializerInterceptor serialize each object a streamed HTTP response yields, so @Exclude(), groups and schemas apply to every line of NDJSON – 8217f2b3b8

  • @Sse(): while Node.js has paused the socket of a client, a : comment is written every 5 s, so that a client that left is noticed – cd963b19bd

  • @nestjs/platform-express, @nestjs/platform-node: a SyntaxError or URIError without a 400 status (e.g. thrown by a middleware passed to app.use()) is answered with a logged 500 rather than a 400 carrying its message – 8d74ddcd3a

  • @nestjs/platform-node: when the matched route would leave a route parameter empty, the request is a 404 – 56c06f48c3

  • Middleware given to forRoutes() is mounted where the router serves the routes it covers, including routes excluded from the global prefix – 521cdea80f

  • Parameter pipes of controllers built with mixins or wrapped by a class decorator that returns a Proxy now run – 7c5792d969

  • The exclude predicate of enableCsrfProtection() excludes a request only when it returns true – 608fcec0a9

  • Gateways on their own port drop clients that connect before onApplicationBootstrap() has finished; socket.io clients reconnect – 7d705cc835

  • In a standalone microservice, a gateway without a port no longer opens a server on a random port; it gets a server that does not listen – 7359d3b06a

  • An @Optional() dependency that exists but fails to build at request time now fails its consumer – 0c360708b5

  • Transient providers with durable dependencies are built per request – 822d93ffd1

  • moduleRef.create() rejects a request-scoped property dependency, as it does for constructor parameters – 6c5fed8b72

New startup errors and warnings

  • A guard, interceptor or pipe that can't run (e.g. an abstract class used as a token, or a class given as the useValue of APP_GUARD) fails the application at startup; an exception filter that can't run logs a warning – 7a81aed500, 407518855f

  • An invalid forRoutes() or exclude() entry fails the application at startup – 1afb768959

  • A gateway that joins a shared server with a verifyClient or allowRequest the server won't run, or gateways on one port that set different hosts, stop the application at startup – 32875410dc, fd0155fba0

  • @nestjs/platform-fastify: @All('x') declared above @Search('x') or a WebDAV method on the same path fails at startup, as the reverse order already did; @All() routes now also answer these methods – a1695d18ea

  • Warnings for exception filter classes bound to a middleware, which don't apply – 3113f03f1e – and for a ValidationPipe that gets no parameter types – f433a1f752

Microservices

  • gRPC: An Error wrapped in an RpcException is logged and answered as "Internal server error"; its numeric code is still used as the status – 2038bff425

  • A filter that throws on a response stream is logged and answered as "Internal server error" – 515f99cfb6

  • Kafka: Events can no longer ask for a reply through reply headers, and replies no longer carry them – d1473338c3; an object with a key or value and other properties is sent as the payload – 73373dc911; a request whose reply topic is one the server handles itself is dropped – 809029b74b

  • RabbitMQ wildcards: a message whose pattern names a different handler than its routing key is not handled – ef8f92c5d0

  • Patterns with a string value over 4096 characters or more than 100 keys get a marker route – ed8ca5cded; multi-key patterns with a non-ASCII key may get a new route, so clients and servers of such patterns should be on the same version – 015456cc2f

@nestjs/core and the platform packages should be updated together, as the adapters pass new route matching options to core.

Bug fixes

  • platform-fastify: fix(fastify): fail an object-mode file stream on a non-bytes chunk (@kamilmysliwiec)

  • platform-fastify: fix(fastify): release file streams of pipelined requests on close (@kamilmysliwiec)

  • platform-fastify: fix(fastify): handle a failed file stream on a raw response (@kamilmysliwiec)

  • platform-fastify: fix(fastify): match routes whose parameter names the router misreads (@kamilmysliwiec)

  • platform-fastify: fix(fastify): merge small file chunks in memory storage as they arrive (@kamilmysliwiec)

  • platform-fastify: fix(fastify): serve the webdav and search methods with @all() routes (@kamilmysliwiec)

  • platform-fastify: fix(fastify): treat an empty repeated route parameter as a route miss (@kamilmysliwiec)

  • platform-fastify: fix(fastify): handle async body parsers and app.use() middleware errors (@kamilmysliwiec)

  • platform-fastify: fix(fastify): lower-case middleware paths like a case-insensitive router (@kamilmysliwiec)

  • platform-fastify: fix(fastify): handle "proto" in urlencoded bodies like json ones (@kamilmysliwiec)

  • platform-fastify: fix(fastify): track plugin contexts when the app registers middie (@kamilmysliwiec)

  • platform-fastify: fix(fastify): remove stored uploads when a client leaves a stalled form (@kamilmysliwiec)

  • platform-fastify: fix(fastify): remove the partial file of a cut-off multipart form (@kamilmysliwiec)

  • platform-fastify: fix(fastify): fail the file stream of a discarded upload (@kamilmysliwiec)

  • platform-fastify: fix(fastify): bound the size of multipart fields parsed as json (@kamilmysliwiec)

  • microservices: fix(microservices): skip scoped global filters not created for a context (@kamilmysliwiec)

  • microservices: fix(microservices): log handler failures of grpc stream calls (@kamilmysliwiec)

  • microservices: fix(microservices): wait for every pipe of a message before failing it (@kamilmysliwiec)

  • microservices: fix(microservices): handle errors in rpc exceptions as unknown in grpc (@kamilmysliwiec)

  • microservices: fix(microservices): sort non-ascii pattern keys without localecompare (@kamilmysliwiec)

  • microservices: fix(microservices): run scoped filters for controller resolution errors (@kamilmysliwiec)

  • microservices: fix(microservices): observe the promises of joined event handlers (@kamilmysliwiec)

  • microservices: fix(microservices): use the default filter when an rpc filter fails (@kamilmysliwiec)

  • microservices: fix(microservices): apply the pattern limits before serializing it (@kamilmysliwiec)

  • microservices: fix(microservices): bound how many messages of a tcp peer are handled (@kamilmysliwiec)

  • microservices: fix(microservices): end streams of tcp messages emitted without an id (@kamilmysliwiec)

  • microservices: fix(microservices): listen on localhost for an empty tcp host option (@kamilmysliwiec)

  • microservices: fix(microservices): flatten the tcp packet buffer after many small reads (@kamilmysliwiec)

  • microservices: fix(microservices): apply the tcp maxbuffersize to each packet (@kamilmysliwiec)

  • microservices: fix(microservices): use the default tcp and kafka limits for nan (@kamilmysliwiec)

  • microservices: fix(microservices): lower the default tcp maxbuffersize to 16 mi (@kamilmysliwiec)

  • microservices: fix(microservices): skip nest replies arriving on nats handler subjects (@kamilmysliwiec)

  • microservices: fix(microservices): limit the redis channels wildcard requests reply on (@kamilmysliwiec)

  • microservices: fix(microservices): reject mqtt topic names with wildcards in clientmqtt (@kamilmysliwiec)

  • microservices: fix(microservices): match mqtt wildcard filters against the sent topic (@kamilmysliwiec)

  • microservices: fix(microservices): count redis requests that wait for the subscription (@kamilmysliwiec)

  • microservices: fix(microservices): print the id of an unmatched redis reply safely (@kamilmysliwiec)

  • microservices: fix(microservices): fail grpc client calls whose requests emit null (@kamilmysliwiec)

  • microservices: fix(microservices): fail grpc streams whose client leaves replies unread (@kamilmysliwiec)

  • microservices: fix(microservices): send grpc error messages that are not strings (@kamilmysliwiec)

  • microservices: fix(microservices): end grpc client stream calls cancelled early (@kamilmysliwiec)

  • microservices: fix(microservices): send objects with other fields as kafka payloads (@kamilmysliwiec)

  • microservices: fix(microservices): check the routing key of rmq wildcard messages (@kamilmysliwiec)

  • microservices: fix(microservices): refuse kafka reply topics the server handles itself (@kamilmysliwiec)

  • microservices: fix(microservices): send kafka events and replies without reply headers (@kamilmysliwiec)

  • microservices: fix(microservices): log kafka entries that json cannot serialize (@kamilmysliwiec)

  • microservices: fix(microservices): keep the kafka consumer running after type errors (@kamilmysliwiec)

  • microservices: fix(microservices): stop kafka servers from keeping streamed replies (@kamilmysliwiec)

  • microservices: fix(microservices): skip rmq wildcard matching for over-long patterns (@kamilmysliwiec)

  • microservices: fix(microservices): reject rmq short strings longer than 255 bytes (@kamilmysliwiec)

  • microservices: fix(microservices): validate kafka and rmq request ids before echoing (@kamilmysliwiec)

  • microservices: fix(microservices): limit the size of rmq messages decoded as json (@kamilmysliwiec)

  • microservices: fix(microservices): chain kafka event handlers with equal regex patterns (@thekhegay)

  • microservices: fix(microservices): handle a cancelled rmq reply consumer in client (@thekhegay)

  • microservices: fix(microservices): fail pending rmq requests when the connection drops (@jaeminbird)

  • platform-express: fix(express): remove rejected uploads of pipelined requests on close (@kamilmysliwiec)

  • platform-express: fix(express): fail an object-mode file stream on a non-bytes chunk (@kamilmysliwiec)

  • platform-express: fix(express): release file streams of pipelined requests on close (@kamilmysliwiec)

  • platform-express: fix(express): answer a failed file stream with plain text (@kamilmysliwiec)

  • platform-express: fix(express): map only client syntax and uri errors to 400 (@kamilmysliwiec)

  • platform-express: fix(express): render a copy of the value a handler returns (@kamilmysliwiec)

  • platform-node: fix(node): map only client syntax and uri errors to 400 (@kamilmysliwiec)

  • platform-node: fix(node): release file streams of pipelined requests on close (@kamilmysliwiec)

  • platform-node: fix(node): fail an object-mode file stream on a non-bytes chunk (@kamilmysliwiec)

  • platform-node: fix(node): catch what the error handler of a file stream throws (@kamilmysliwiec)

  • platform-node: fix(node): treat an empty parameter of the matched route as a miss (@kamilmysliwiec)

  • platform-node: fix(node): match "//" as the pattern of a root optional group route does (@kamilmysliwiec)

  • platform-node: fix(node): merge small body chunks as they arrive (@kamilmysliwiec)

  • platform-node: fix(node): pass errors of the send file callback to the error handlers (@kamilmysliwiec)

  • platform-node: fix(node): validate the headers option of a sent file up front (@kamilmysliwiec)

  • platform-node: fix(node): leave the router on next('router') as express does (@kamilmysliwiec)

  • platform-node: fix(node): reject multipart field names that set prototype keys (@kamilmysliwiec)

  • common, core: fix(common,core): use the default for pipe and sse limits given as nan (@kamilmysliwiec)

  • common, core: fix(core,common): exclude requests only when the predicate returns true (@kamilmysliwiec)

  • common, core: fix(core,common): read the catch types of a filter from its prototype (@kamilmysliwiec)

  • common, core: fix(common,core): send the status text in sse errors that wrap an error (@kamilmysliwiec)

  • common, core: fix(common,core): count sse events without data toward the pending limit (@kamilmysliwiec)

  • platform-socket.io, platform-ws: fix(ws,socket.io): use the default for adapter limits given as nan (@kamilmysliwiec)

  • core: fix(core): warn about an exception filter that can't run (@kamilmysliwiec)

  • core: fix(core): throw for a guard, interceptor or pipe that can't run (@kamilmysliwiec)

  • core: fix(core): run the container instance of a class-bound enhancer (@kamilmysliwiec)

  • core: fix(core): use the enhancers of the module that holds the host (@kamilmysliwiec)

  • core: fix(core): mount middleware on a route path that really ends in "$" (@kamilmysliwiec)

  • core: fix(core): mount a controller root route without the slash after a tail (@kamilmysliwiec)

  • core: fix(core): resolve a forward reference to a module only once (@kamilmysliwiec)

  • core: fix(core): mount module middleware in order when configure() awaits (@kamilmysliwiec)

  • core: fix(core): reject a middleware target that is not a controller or route (@kamilmysliwiec)

  • core: fix(core): warn that filter classes bound to a middleware do not apply (@kamilmysliwiec)

  • core: fix(core): keep the filters of a middleware's use() with exclude() (@kamilmysliwiec)

  • core: fix(core): test each versioned path against the prefix exclusions alone (@kamilmysliwiec)

  • core: fix(core): mount middleware where the router serves the covered routes (@kamilmysliwiec)

  • core: fix(core): compare a prefix exclusion with a trailing slash as served (@kamilmysliwiec)

  • core: fix(core): run the middleware for a path with a line terminator (@kamilmysliwiec)

  • core: fix(core): keep a controller root route next to an optional-tail route (@kamilmysliwiec)

  • core: fix(core): inject the provider an alias stands for (@kamilmysliwiec)

  • core: fix(core): inject the strategy payload into durable providers as request (@kamilmysliwiec)

  • core: fix(core): keep transient instances out of durable sub-trees (@kamilmysliwiec)

  • core: fix(core): release removed wrappers from the providers they depended on (@kamilmysliwiec)

  • core: fix(core): fail the consumer when an optional dependency fails to load (@kamilmysliwiec)

  • core: fix(core): build a lazy module once when loads overlap (@kamilmysliwiec)

  • core: fix(core): give unserializable dynamic modules their own deep-hash ids (@kamilmysliwiec)

  • core: fix(core): reject create() when a property dependency is request-scoped (@kamilmysliwiec)

  • core: fix(core): keep create() working after many calls in snapshot mode (@kamilmysliwiec)

  • core: fix(core): stop reloading durable instances marked by a failed load (@kamilmysliwiec)

  • core: fix(core): skip exception filters that were not created for a request (@kamilmysliwiec)

  • core: fix(core): answer http errors that graphql or async rpc filters leave (@kamilmysliwiec)

  • core: fix(core): keep host params matched next to an optional group (@kamilmysliwiec)

  • core: fix(core): notice an sse client that left while its socket is paused (@kamilmysliwiec)

  • core: fix(core): write the waiting events of an sse client in linear time (@kamilmysliwiec)

  • core: fix(core): catch what the teardown of an sse producer throws (@kamilmysliwiec)

  • core: fix(core): send what the interceptors return for a streaming handler (@kamilmysliwiec)

  • core: fix(core): share one close listener among the requests of a connection (@kamilmysliwiec)

  • core: fix(core): read a streamed body in the async context of its request (@kamilmysliwiec)

  • core: fix(core): listen for the error of every stream the router holds (@kamilmysliwiec)

  • common, core, microservices, websockets: fix(core,microservices,websockets): drop gateway clients during startup (@kamilmysliwiec)

  • core, microservices, websockets: fix(core): warn when a validation pipe gets no parameter types (@kamilmysliwiec)

  • core, microservices, websockets: fix(core,websockets): read parameter metadata from the declaring class (@kamilmysliwiec)

  • platform-socket.io, platform-ws, websockets: fix(websockets,ws,socket.io): open no port for a gateway without one (@kamilmysliwiec)

  • platform-socket.io, platform-ws, websockets: fix(socket.io): cap how many messages of a client wait for their turn (@kamilmysliwiec)

  • platform-socket.io, platform-ws, websockets: fix(websockets,ws,socket.io): free a client's last handled message (@kamilmysliwiec)

  • websockets: fix(websockets): refuse a gateway whose connection check would not run (@kamilmysliwiec)

  • websockets: fix(websockets): share streams of gateways on "/" and on no namespace (@kamilmysliwiec)

  • websockets: fix(websockets): wait for every pipe of a message before failing it (@kamilmysliwiec)

  • websockets: fix(websockets): run a scoped gateway's disconnect hook after connect (@kamilmysliwiec)

  • websockets: fix(websockets): log an error of a connection hook's exception filter (@kamilmysliwiec)

  • websockets: fix(websockets): keep the options of a gateway whose port is not set (@kamilmysliwiec)

  • websockets: fix(websockets): share one host between gateways of a namespace (@kamilmysliwiec)

  • websockets: fix(websockets): connect gateways in the order they are declared in (@kamilmysliwiec)

  • platform-socket.io, websockets: fix(websockets,socket.io): stop echoing binary data in error replies (@kamilmysliwiec)

  • platform-ws, websockets: fix(websockets): count a message as handled until its filter is done (@kamilmysliwiec)

  • platform-ws: fix(ws): refuse gateways on one port that set different hosts (@kamilmysliwiec)

  • platform-ws: fix(ws): refuse a client whose upgrade check throws (@kamilmysliwiec)

  • platform-ws: fix(ws): notice a paused client that has left (@kamilmysliwiec)

  • platform-ws: fix(ws): keep a client paused while any gateway on it is backlogged (@kamilmysliwiec)

  • platform-ws: fix(ws): limit the size of the messages a client may send (@kamilmysliwiec)

  • platform-ws: fix(ws): leave upgrade requests for other paths to other listeners (@mtnaskari)

  • common, core, platform-fastify: fix(core,fastify): match the text after an excluded param as written (@kamilmysliwiec)

  • common, core, platform-fastify: fix(core,fastify): end the excluded path at ";" like the fastify router (@kamilmysliwiec)

  • common, core, platform-fastify: fix(core,fastify): exclude "/x/" only when no other route may serve it (@kamilmysliwiec)

  • common, core, platform-fastify, platform-node: fix(core,fastify,node): match excluded params up to the router's limit (@kamilmysliwiec)

  • platform-fastify, platform-node: fix(fastify,node): match middleware in the forms the router decodes (@kamilmysliwiec)

  • common: fix(common): keep the scope a class declares when passed to mixin() (@kamilmysliwiec)

  • common: fix(common): serialize the objects a streamed http response yields (@kamilmysliwiec)

  • common: fix(common): serialize the values of a stream in linear time (@kamilmysliwiec)

  • common: fix(common): close the gaps of sparse arrays the pipes validate (@kamilmysliwiec)

  • common: fix(common): validate the files of parse file pipe one at a time (@kamilmysliwiec)

  • common: fix(common): validate a stand-in for a buffer sent as the whole value (@kamilmysliwiec)

  • common: fix(common): reject a buffer held by a nested validated property (@kamilmysliwiec)

  • common: fix(common): reject a buffer sent in place of a validated class (@kamilmysliwiec)

  • common: fix(common): drop the value of validation errors that have children (@kamilmysliwiec)

  • common: fix(common): rethrow non-validation errors in the parse array pipe (@kamilmysliwiec)

  • common: fix(common): limit the length of standard schema error messages (@kamilmysliwiec)

  • common: fix(common): limit the error messages of parsed array items in total (@kamilmysliwiec)

  • common: fix(common): check the json log record cap before converting values (@kamilmysliwiec)

  • common: fix(common): count empty strings toward the json log record cap (@kamilmysliwiec)

  • common: fix(common): keep logged key names out of the redactor cache keys (@kamilmysliwiec)

  • common: fix(common): let a null depth print every level in the console logger (@gjija)

  • platform-express, platform-fastify, platform-node: fix(express,fastify,node): close the array gaps of multipart bodies (@kamilmysliwiec)

  • platform-express, platform-fastify, platform-node: fix(express,fastify,node): cut off an upload once the response is sent (@kamilmysliwiec)

  • platform-express, platform-fastify, platform-node: fix(express,fastify,node): fail the request when an upload filter throws (@kamilmysliwiec)

  • platform-express, platform-fastify, platform-node: fix(express,fastify,node): keep module upload options a route leaves out (@kamilmysliwiec)

  • platform-express, platform-node: fix(express,node): default the multipart parts limit to 1000 (@kamilmysliwiec)

  • microservices, websockets: fix(microservices,websockets): scope parameter pipes to each context (@beyondwin)

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.