Returning a 404 feels like the cheapest thing a server can do: no database queries, just reject an unknown path and move on. In reality, nearly a third of the CPU spent on every 404 was going to waste. Patch NestJS 12.6.3—released November 26, 2026, one day after 12.6.2—eliminates that overhead, brings instrument to tests, and fixes subtle bugs in routing, Fastify, WebSockets, and gRPC.
Faster 404s and Instrumentation in Tests
The extra CPU cost lived inside routes-resolver.ts. On an unknown route, NestJS threw NotFoundException, causing V8 to capture a full stack trace across framework and adapter frames. Building stack traces is CPU-heavy, yet built-in filters don't even log HttpException. Now 404s are created without a stack trace, cutting CPU time by 28–29% on Express, Fastify, and the Node adapter (from 21.9 down to 15.5 µs on Express). Against bot traffic, that's free headroom with zero code changes.
The second addition closes a gap between production and tests for observability tools like NestJS Observe and OpenTelemetry. NestFactory.create() already supported an instrument option with an instanceDecorator callback that wraps DI-created providers for tracing or metrics. Previously, Test.createTestingModule() ignored it, causing NestJS Observe gateway tests to complain about missing spans. Now you pass it as the second argument.
// Enable the same tracing setup used in production
const moduleRef = await Test.createTestingModule(
{ imports: [AppModule] },
{
instrument: {
instanceDecorator: (inst) => wrapWithTracing(inst),
},
},
)
.overrideProvider(PasswordHasher)
.useValue(fastHasher)
.compile();
// The created app inherits instrument automatically
const app = moduleRef.createNestApplication();
The decorator wraps all module providers, including ones replaced via overrideProvider. Any createNestApplication(), createNestMicroservice(), gateway, or microservice handler spawned from it inherits instrument automatically unless overridden. The patch also fixes resolve() on NestApplicationContext so request-scoped and transient providers pass through instanceDecorator in both tests and NestFactory.createApplicationContext().
Behavior Fixes That May Surface Old Bugs
This isn't labeled a breaking release, yet a few fixes can expose latent bugs at startup. The duplicate route detector used to compare paths with ===; now it respects router rules. On Express by default and on Fastify with caseSensitive: false, GET /users and GET /Users count as duplicates and halt startup when duplicate: 'error' is set. Case-sensitive routers (default Fastify, Node adapter, Express with case sensitive routing) behave as before.
// On Express, both controllers match GET /users -> conflict
@Controller('users')
class LowerUsersController { @Get() lower() {} }
@Controller('Users')
class UpperUsersController { @Get() upper() {} }
// @Body('key') with "", 0, or false now returns undefined
@Post('flag')
handleFlag(@Body('enabled') enabled: unknown) {
return { enabled };
}
// ParseDatePipe rejects 2/30, 4/31, 2/29, and Thu 2024 Sept 31
@Get('events')
findEvents(@Query('date', ParseDatePipe) date: Date) {
return { date };
}
Three more fixes address quiet inconsistencies. In MiddlewareConsumer.exclude() and enableCsrfProtection(), versionless paths now match default versioned routes just like forRoutes(). @Body('key') returns undefined instead of the whole body when a property is "", 0, or false. ParseDatePipe rejects invalid calendar dates in yearless or weekday strings (including 2/29, since new Date() defaults to 2001). Additionally, referrerPolicy.policy rejects undefined, and enableVersioning() no longer mutates its options object.
Fixes for Fastify, WebSockets, and gRPC
@nestjs/platform-fastify resolves four bugs. httpAdapter.render() now works on raw responses in middleware and exception filters without throwing response.view is not a function. app.listen(port, host, backlog) passes backlog to Fastify instead of mistaking the number for a callback. Requests aborted mid-body now yield 400 HttpException rather than an unhandled error. And StreamableFile (for streaming files without buffering them in memory) with status 304 skips reading the stream and returns no body.
In @nestjs/websockets, gateways with slightly different path strings (events vs /events/) now share one socket.io server instead of spawning a second empty one. On shared servers, handleDisconnect fires once per disconnect even if other clients are disconnected inside it. Finally, GrpcExceptionFilter now logs non-RpcException errors before replying with UNKNOWN, matching BaseRpcExceptionFilter.
