unstale

npm / fastify

fastify

What changed in fastify 5, from its official release notes, upgrade guides and advisories. Sources checked 2026-10-18.

5 breaking15 security7 new APIs and options9 performance56 fixes and other

See which of these apply to your code, ranked, in your agent:

npx @unstale/cli init

@unstale/cli on npm

fastify 592 changes

Breaking changes 5

  • Type definitions now restrict route lookup methods.

    5.12.6release notes

  • Raw response headers are removed.

    5.12.0release notes

  • Parsing of the content-type header now uses a strict parser and accepts only values in the form described by RFC 9110.

    5.7.2release notes

  • The types require a send() payload when a Reply type is specified.

    5.7.0release notes

  • The error parameter type is now unknown and can be configured with the generic TError.

    5.6.2release notes

Security 15

New APIs and options 7

Performance 9

  • Parsed content-types now use a FIFO cache.

    5.12.6release notes

  • String bodies are decoded once instead of once per chunk.

    5.12.6release notes

  • Reduces content-type parser overhead.

    5.12.5release notes

  • Avoids redundant request-part reads during validation.

    5.12.5release notes

  • Reuses cached content types during response serialization.

    5.11.0release notes

  • Reduces per-request overhead in the request lifecycle.

    5.10.0release notes

  • Defers ContentType parsing in getSchemaSerializer until needed.

    5.9.0release notes

  • Caches parsed ContentType objects in ContentTypeParser.

    5.9.0release notes

  • Loading with a custom compiler is faster.

    5.7.0release notes

Fixes and other changes 56

  • An HTTP QUERY request with an empty body no longer causes an error.

    5.12.6release notes

  • Header names in propertyNames enum and const validation are lowercased.

    5.12.6release notes

  • An array passed for set-cookie is copied instead of stored directly.

    5.12.6release notes

  • reply.mediaType is now resolved from raw response headers.

    5.12.6release notes

  • Request child loggers no longer have their level reset.

    5.12.6release notes

  • Fixed the fastify.js version mismatch.

    5.12.4release notes

  • Runs the not-found preHandler regardless of registration order.

    5.12.2release notes

  • Reports the canonical route URL for a hidden prefix slash route.

    5.12.1release notes

  • Runs the preClose hook exactly once per declaring instance.

    5.12.1release notes

  • Invalid media types now return undefined.

    5.12.0release notes

  • Global and sticky content-type RegExp parsers reset lastIndex before testing.

    5.11.3release notes

  • Constructor-assigned built-in properties are now recognized as decorators.

    5.11.3release notes

  • Removing all trailers now clears trailer state.

    5.11.3release notes

  • Corrects the Fastify version in fastify.js.

    5.11.2release notes

  • When forceCloseConnections is 'idle', in-flight connections are no longer force-closed.

    5.11.1release notes

  • Adds a warning related to HTTP method override.

    5.11.1release notes

  • Server options types now allow explicitly setting http2 to false.

    5.11.1release notes

  • Fixes uncatchable throws in writeHead when an async hook is used.

    5.11.0release notes

  • Honors quoted-string syntax in Content-Type parameter values.

    5.11.0release notes

  • Correctly updates falsy values returned by the validator.

    5.11.0release notes

  • Clears socket._meta on reply.hijack() when onTimeout is registered.

    5.10.0release notes

  • Uses ContentType to detect json and charset in reply.send.

    5.10.0release notes

  • Derives request.port from request.host.

    5.10.0release notes

  • Enables diagnostics tracking for async error handlers.

    5.9.0release notes

  • checkDependencies now uses FST_ERR_PLUGIN_DEPENDENCY_NOT_REGISTERED instead of AssertionError.

    5.9.0release notes

  • Detects constructor-assigned built-in properties that were previously missed.

    5.9.0release notes

  • Detects constructor-assigned built-in properties that were previously missed.

    5.9.0release notes

  • Chunks large HTTP/2 buffer replies.

    5.9.0release notes

  • Corrects the isCustomSerializerCompiler flag check.

    5.9.0release notes

  • Avoids a double slash when joining nested prefixes.

    5.9.0release notes

  • Allows request.getValidationFunction() to return undefined in its types.

    5.9.0release notes

  • Uses the ContentType parser for response schema lookup.

    5.9.0release notes

  • Validates an invalid route logLevel during route registration.

    5.9.0release notes

  • Fixes routing errors that did not include error.code.

    5.9.0release notes

  • Prevents duplicate res.end calls when sendTrailer uses synchronous callbacks.

    5.9.0release notes

  • Clears socket._meta after the response to prevent keep-alive leaks.

    5.9.0release notes

  • Ignores duplicate trailer completions.

    5.9.0release notes

  • Fixes port parsing.

    5.8.5release notes

  • Restores the trustProxy function for number and string types and adds a null check for socketAddr.

    5.8.5release notes

  • The request type definition now allows port to be null.

    5.8.3release notes

  • Anchored the regular expression to prevent quadratic backtracking.

    5.8.2release notes

  • Fixes validation that allowed malformed Content-Types to pass.

    5.8.1release notes

  • Removes a format placeholder from the invalid media type error message.

    5.8.0release notes

  • Prevents routerOptions from being mutated across Fastify instances.

    5.8.0release notes

  • Accepts async route hooks in shorthand options.

    5.8.0release notes

  • AJV options type validation is fixed.

    5.7.0release notes

  • The status code is set before publishing to the diagnostics error channel.

    5.7.0release notes

  • Uses JSON.stringify for proper escaping of bad URLs.

    5.7.0release notes

  • The types for routerOptions.defaultRoute now align with runtime behavior.

    5.7.0release notes

  • Fastify options now respect the child logger factory.

    5.6.2release notes

  • Error handling is now consistent for custom validators in asynchronous validation contexts.

    5.6.2release notes

  • Web stream payloads are now handled in HEAD routes.

    5.6.2release notes

  • Fastify now accepts horizontal tab optional whitespace.

    5.6.2release notes

  • IPv6 hostnames are now parsed correctly.

    5.6.2release notes

  • Fixes error throwing in reply.

    5.6.2release notes

  • Custom error handlers now properly handle errors that are not FastifyErrors.

    5.6.2release notes