NestJS v12.6.3 came out on 26 November 2026. It’s a patch release, but the notes include a section titled “Behaviour changes”, which is unusual for a patch. Most apps will upgrade without noticing anything. But if you use Express with case-variant routes, versioned middleware exclusions, @Body('key'), ParseDatePipe or gRPC microservices, some code may behave differently after npm update.
This guide goes through each change with a small example, then covers the new testing feature and the Fastify and WebSocket fixes.
Upgrade
npm install @nestjs/[email protected] @nestjs/[email protected] @nestjs/[email protected]
# add @nestjs/platform-fastify, @nestjs/microservices, @nestjs/websockets,
# @nestjs/testing if you use them, all on the same version
npm ls @nestjs/core
Keep every @nestjs/* package on the same version, because mismatched core and platform packages cause hard-to-debug errors.
Behaviour change 1: route conflicts are case-insensitive on Express
Nest can detect duplicate routes at startup. With duplicate: 'error', a conflict aborts bootstrap. Before 12.6.3, the check compared paths exactly, so GET /users and GET /Users looked like two different routes.
But Express matches paths case-insensitively by default, so in reality both handlers competed for the same URL. In 12.6.3, conflict detection compares paths the way the router actually matches them:
@Controller()
export class UsersController {
@Get('users')
list() { /* ... */ }
@Get('Users') // now reported as a duplicate of GET /users on Express
legacyList() { /* ... */ }
}
The same applies on Fastify with caseSensitive: false. Nothing changes where the router is case-sensitive: Fastify by default, the Node adapter, and Express with case sensitive routing enabled.
What to do: start the app once after upgrading. If you use duplicate: 'error' and bootstrap now fails with a duplicate-route error, you’ve found a real bug, because one of those handlers could never be reached.
Behaviour change 2: unversioned exclusions also cover the default version
If you use URI versioning with a default version, you may exclude a path from middleware without giving a version:
export class AppModule implements NestModule {
configure(consumer: MiddlewareConsumer) {
consumer
.apply(AuditMiddleware)
.exclude({ path: 'health', method: RequestMethod.GET })
.forRoutes('*');
}
}
In 12.6.3, a path excluded without a version also covers the routes of the default version(s), the same way forRoutes() already did. The same rule applies to the exclude option of enableCsrfProtection().
What to do: if you relied on middleware still running for the default-versioned route, for example CSRF protection on a path you meant to exclude only for unversioned calls, review your exclusions. In most apps this change simply makes the exclusion work the way it was meant to.
Behaviour change 3: @Body('key') with a falsy primitive body
When a client sends a primitive JSON body such as "", 0 or false, @Body('key') now returns undefined, as it already did for other primitive bodies. Before, it received the whole body.
@Post('toggle')
toggle(@Body('enabled') enabled: boolean | undefined) {
// Body: false -> enabled is undefined (was: false)
// Body: {"enabled": false} -> enabled is false (unchanged)
}
What to do: if a client sends bare true/false and you read it through @Body('something'), switch to @Body() or send an object. Adding a ValidationPipe with a DTO will catch this kind of mismatch in the future.
Behaviour change 4: stricter ParseDatePipe
ParseDatePipe now rejects impossible days in two date shapes:
- Numeric dates without a year, such as
2/30or4/31. As withnew Date(), such a date is treated as being in 2001, so2/29is rejected too. - Year-first month-name dates after a weekday, such as
Thu 2024 Sept 31.
@Get('bookings')
find(@Query('from', new ParseDatePipe()) from: Date) {
// GET /bookings?from=2/30 -> 400 Bad Request in 12.6.3
}
What to do: nothing, unless you have tests that expected those inputs to roll over into the next month. ISO dates like 2026-11-27 are the safest format for APIs anyway.
Behaviour change 5: gRPC exceptions are logged
GrpcExceptionFilter now logs an exception that isn’t an RpcException before answering with UNKNOWN, as BaseRpcExceptionFilter does. Before, the client got UNKNOWN and nothing showed up in the server logs. You may see new error lines after upgrading. They aren’t new errors, just errors that were previously silent.
Behaviour change 6: stricter referrerPolicy
In the security headers options, an undefined entry in referrerPolicy.policy is now rejected like any other invalid value. If you build that array from config, filter out empty values first:
const policy = [process.env.REFERRER_POLICY, 'strict-origin-when-cross-origin'].filter(Boolean);
New: the instrument option in testing modules
Test.createTestingModule() now accepts the instrument option, just like NestFactory.create(). Its instanceDecorator decorates the module’s providers, including overridden ones. Apps and microservices created from the testing module use it unless their own options set one. Request-scoped and transient providers created through resolve() are passed to the decorator too.
The point is that tests can run your app instrumented the same way it runs in production. For example, the notes say that with NestJS Observe, gateway tests no longer log that the instrument option is missing.
const moduleRef = await Test.createTestingModule({
imports: [AppModule],
instrument: productionInstrumentOptions, // reuse what you pass to NestFactory.create()
}).compile();
const app = moduleRef.createNestApplication();
await app.init();
Here productionInstrumentOptions stands for the same object you already pass to NestFactory.create() in main.ts. Export it from a shared file so the app and the tests can’t drift apart.
Performance: cheaper 404s
The 404 that Nest throws for an unmatched route is now created without a stack trace. The release notes report 28 to 29% less server CPU time per 404 on Express, Fastify and Node, from 21.9 µs to 15.5 µs on Express. That’s useful when bots scan your API for random paths.
Fastify and WebSocket fixes
httpAdapter.render()works on the raw response that middleware and their exception filters receive. It used to throwresponse.view is not a function.app.listen(port, host, backlog)now passes the backlog to Fastify. It used to be passed as the callback.- A
StreamableFilesent with a 304 status isn’t read, and the 304 goes out without a body. - A request aborted by the client mid-body becomes a 400
HttpExceptioninstead of an unexpected error. - WebSocket gateways whose
pathis spelled differently (events,/events/) now share one server. Before, the second gateway got its own server that never received a client. - With gateways that share a socket.io server, each disconnect is handled once, even when a
handleDisconnecthook disconnects other clients.
Takeaway
NestJS 12.6.3 is mostly a correctness release, and its behaviour changes fix real bugs rather than adding new rules. Upgrade every @nestjs/* package together, boot the app once to catch newly detected duplicate routes, and grep for @Body(', ParseDatePipe and .exclude( before you deploy. The full release notes link to the pull request behind each change.
