Upgrading fastify 4 to 5
Breaking4.29.1 → 5.12.8Breaking21Security15New27Changed34Fixed104Other606
Fetching 44 releases from GitHub…43 / 44
SecurityLow · CVSS 3.7Fixes the vulnerability described in security advisory GHSA-389g-gv7q-r4x8.GHSA-389g-gv7q-r4x8 · CVE-2026-107832 ↗
BreakingUpgrade verdict
21 breaking changes and 15 security fixes.
In plain terms
- Removes connection property in FastifyRequest types.
- Two methods for setting and reading the default route are gone.
- Fastify no longer reads a request id header by default.
- Calling listen with positional arguments instead of an options object no longer works.
Must act Top 5 of 36 that need code or config changes
What you must change
Breaking21
Removes connection property in FastifyRequest types.
FastifyRequestFastifyRequest.connectionRemoves the setDefaultRoute and getDefaultRoute methods.
setDefaultRoutegetDefaultRouteChanges the request id header default value to false.
requestIdHeaderRemoves the deprecated variadic listen signature.
listenRemoves the variadic listen types.
listenRequest and reply decorators can no longer be a reference type.
Removes reply.getResponseTime().
reply.getResponseTime()Removes the json shorthand option.
jsonRemoves deprecation code 005.
Removes deprecation code FSTDEP007.
FSTDEP007Removes deprecation codes FSTDEP008 and FSTDEP009.
FSTDEP008FSTDEP009Removes deprecation code FSTDEP010.
FSTDEP010Removes deprecation code FSTDEP021.
FSTDEP021Removes deprecation codes FSTDEP012, FSTDEP015, FSTDEP016, FSTDEP017, FSTDEP018 and FSTDEP019.
FSTDEP012FSTDEP015FSTDEP016FSTDEP017FSTDEP018FSTDEP019Removes deprecation code FSTDEP013.
FSTDEP013Removes the nonexistent done parameter from the onRegister type.
onRegisterParses the content-type header with a strict parser, accepting only RFC 9110 forms.
content-typeMoves router options to their own key.
Disallows decorate('name', null) in the TypeScript types.
decorateChanges the reply.redirect() signature.
reply.redirect()Re-orders FastifyReply generic parameters in the TypeScript types.
FastifyReplySecurity15
Fixes the vulnerability described in security advisory GHSA-389g-gv7q-r4x8.
Low · CVSS 3.7Fixes a security vulnerability described in advisory GHSA-4mh8-r7rc-xpvc.
Moderate · CVSS 5.9Fixes security advisory GHSA-9q9j-q6p8-xq58.
High · CVSS 7.5Fixes security advisory GHSA-hwr6-493r-vm6h.
High · CVSS 7.5Fixes security advisory GHSA-p68q-wchp-6fh7.
High · CVSS 7.5Fixes security advisory GHSA-667r-xxjv-c9mm.
High · CVSS 8.1Fixes security advisory GHSA-w2qp-rph6-63g4.
Moderate · CVSS 5.4Fixes security advisory GHSA-3m5p-2c4r-xxw2.
Moderate · CVSS 6.1Stops trusting forwarded host and proto headers when the socket is missing.
Fixes CVE-2026-33806, a security vulnerability in fastify.
High · CVSS 7.5Fixes CVE-2026-3635, a security vulnerability in fastify.
Moderate · CVSS 6.1Fixes missing end anchor in subtypeNameReg that allowed malformed Content-Types to pass validation (CVE-2026-3419).
subtypeNameRegModerate · CVSS 5.3Fixes security advisory GHSA-mrq3-vjjr-p77c, tracked as CVE-2026-25224.
Low · CVSS 3.7Fastify's Content-Type header tab character allows body validation bypass
High · CVSS 7.5Fixes invalid content-type parsing that could lead to validation bypass (CVE-2025-32442).