fastify 5.7.4 → 5.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +1 -1
  3. package/SECURITY.md +20 -20
  4. package/build/build-validation.js +2 -0
  5. package/docs/Guides/Ecosystem.md +7 -59
  6. package/docs/Guides/Fluent-Schema.md +2 -1
  7. package/docs/Guides/Migration-Guide-V4.md +9 -8
  8. package/docs/Guides/Migration-Guide-V5.md +1 -1
  9. package/docs/Guides/Serverless.md +1 -1
  10. package/docs/Reference/ContentTypeParser.md +2 -1
  11. package/docs/Reference/Decorators.md +4 -2
  12. package/docs/Reference/Errors.md +5 -0
  13. package/docs/Reference/Hooks.md +85 -23
  14. package/docs/Reference/LTS.md +2 -2
  15. package/docs/Reference/Lifecycle.md +16 -1
  16. package/docs/Reference/Logging.md +11 -7
  17. package/docs/Reference/Middleware.md +3 -2
  18. package/docs/Reference/Reply.md +15 -8
  19. package/docs/Reference/Request.md +17 -1
  20. package/docs/Reference/Routes.md +15 -6
  21. package/docs/Reference/Server.md +135 -14
  22. package/docs/Reference/Type-Providers.md +5 -5
  23. package/docs/Reference/TypeScript.md +14 -10
  24. package/docs/Reference/Validation-and-Serialization.md +28 -1
  25. package/fastify.d.ts +1 -0
  26. package/fastify.js +3 -1
  27. package/lib/config-validator.js +324 -296
  28. package/lib/content-type-parser.js +1 -1
  29. package/lib/context.js +5 -2
  30. package/lib/errors.js +12 -1
  31. package/lib/reply.js +23 -1
  32. package/lib/request.js +18 -1
  33. package/lib/route.js +45 -4
  34. package/lib/symbols.js +4 -0
  35. package/package.json +5 -5
  36. package/scripts/validate-ecosystem-links.js +179 -0
  37. package/test/content-parser.test.js +25 -1
  38. package/test/handler-timeout.test.js +367 -0
  39. package/test/internals/errors.test.js +2 -2
  40. package/test/internals/initial-config.test.js +2 -0
  41. package/test/request-error.test.js +41 -0
  42. package/test/router-options.test.js +42 -0
  43. package/test/scripts/validate-ecosystem-links.test.js +339 -0
  44. package/test/types/dummy-plugin.ts +2 -2
  45. package/test/types/fastify.test-d.ts +1 -0
  46. package/test/types/logger.test-d.ts +17 -18
  47. package/test/types/register.test-d.ts +2 -2
  48. package/test/types/reply.test-d.ts +2 -2
  49. package/test/types/request.test-d.ts +4 -3
  50. package/test/types/route.test-d.ts +6 -0
  51. package/test/types/type-provider.test-d.ts +1 -1
  52. package/test/web-api.test.js +75 -0
  53. package/types/errors.d.ts +2 -0
  54. package/types/logger.d.ts +1 -1
  55. package/types/request.d.ts +2 -0
  56. package/types/route.d.ts +35 -21
  57. package/types/tsconfig.eslint.json +0 -13
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2016-present The Fastify Team (members are listed in the README file)
3
+ Copyright (c) 2016-present The Fastify team <https://github.com/fastify/fastify#team>
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -199,7 +199,7 @@ If you learn best by reading code, explore the official [demo](https://github.co
199
199
 
200
200
  __Machine:__ EX41S-SSD, Intel Core i7, 4Ghz, 64GB RAM, 4C/8T, SSD.
201
201
 
202
- __Method:__: `autocannon -c 100 -d 40 -p 10 localhost:3000` * 2, taking the
202
+ __Method__: `autocannon -c 100 -d 40 -p 10 localhost:3000` * 2, taking the
203
203
  second average
204
204
 
205
205
  | Framework | Version | Router? | Requests/sec |
package/SECURITY.md CHANGED
@@ -6,7 +6,7 @@ project and its official plugins.
6
6
  ## Threat Model
7
7
 
8
8
  Fastify's threat model extends the
9
- [Node.js threat model](https://github.com/nodejs/node/blob/main/SECURITY.md#the-nodejs-threat-model).
9
+ [Node.js security policy](https://github.com/nodejs/node/blob/main/SECURITY.md).
10
10
 
11
11
  **Trusted:** Application code (plugins, handlers, hooks, schemas), configuration,
12
12
  and the runtime environment.
@@ -14,6 +14,10 @@ and the runtime environment.
14
14
  **Untrusted:** All network input (HTTP headers, body, query strings, URL
15
15
  parameters).
16
16
 
17
+ Fastify assumes Node.js is running with `insecureHTTPParser: false` (the
18
+ secure default). Deployments that enable `insecureHTTPParser: true` are
19
+ outside Fastify's threat model.
20
+
17
21
  ### Examples of Vulnerabilities
18
22
 
19
23
  - Parsing flaws that bypass validation or security controls
@@ -36,6 +40,9 @@ patterns for routes or validation
36
40
  authorization (these are application-level concerns)
37
41
  - **Configuration mistakes**: Security issues arising from developer
38
42
  misconfiguration (configuration is trusted)
43
+ - **`insecureHTTPParser: true` deployments**: Reports that rely on enabling
44
+ Node.js `insecureHTTPParser` are out of scope; Fastify assumes this flag is
45
+ `false`
39
46
  - **Third-party dependencies**: Vulnerabilities in npm packages used by the
40
47
  application (not Fastify core dependencies)
41
48
  - **Resource exhaustion from handlers**: DoS caused by expensive operations in
@@ -46,11 +53,16 @@ explicitly enabled via configuration options
46
53
  ## Reporting vulnerabilities
47
54
 
48
55
  Individuals who find potential vulnerabilities in Fastify are invited to
49
- complete a vulnerability report via the GitHub Security page:
56
+ complete a vulnerability report via the
57
+ [GitHub Security page](https://github.com/fastify/fastify/security/advisories/new).
50
58
 
51
- https://github.com/fastify/fastify/security/advisories/new
59
+ Do not assign or request a CVE directly.
60
+ CVE assignment is handled by the Fastify Security Team.
61
+ Fastify falls under the [OpenJS CNA](https://cna.openjsf.org/).
62
+ A CVE will be assigned as part of our responsible disclosure process.
52
63
 
53
- Note: Our [HackerOne](https://hackerone.com/fastify) program is now closed.
64
+ > ℹ️ Note:
65
+ > Fastify's [HackerOne](https://hackerone.com/fastify) program is now closed.
54
66
 
55
67
  ### Strict measures when reporting vulnerabilities
56
68
 
@@ -61,7 +73,7 @@ reported vulnerabilities:
61
73
  * Avoid creating new "informative" reports. Only create new
62
74
  reports on a vulnerability if you are absolutely sure this should be
63
75
  tagged as an actual vulnerability. Third-party vendors and individuals are
64
- tracking any new vulnerabilities reported in HackerOne or GitHub and will flag
76
+ tracking any new vulnerabilities reported on GitHub and will flag
65
77
  them as such for their customers (think about snyk, npm audit, ...).
66
78
  * Security reports should never be created and triaged by the same person. If
67
79
  you are creating a report for a vulnerability that you found, or on
@@ -106,9 +118,6 @@ Triaging should include updating issue fields:
106
118
  * Asset - set/create the module affected by the report
107
119
  * Severity - TBD, currently left empty
108
120
 
109
- Reference: [HackerOne: Submitting
110
- Reports](https://docs.hackerone.com/hackers/submitting-reports.html)
111
-
112
121
  ### Correction follow-up
113
122
 
114
123
  **Delay:** 90 days
@@ -136,27 +145,18 @@ The report's vulnerable versions upper limit should be set to:
136
145
  Within 90 days after the triage date, the vulnerability must be made public.
137
146
 
138
147
  **Severity**: Vulnerability severity is assessed using [CVSS
139
- v.3](https://www.first.org/cvss/user-guide). More information can be found on
140
- [HackerOne documentation](https://docs.hackerone.com/hackers/severity.html)
148
+ v.3](https://www.first.org/cvss/user-guide).
141
149
 
142
150
  If the package maintainer is actively developing a patch, an additional delay
143
151
  can be added with the approval of the security team and the individual who
144
152
  reported the vulnerability.
145
153
 
146
- At this point, a CVE should be requested through the selected platform through
147
- the UI, which should include the Report ID and a summary.
148
-
149
- Within HackerOne, this is handled through a "public disclosure request".
150
-
151
- Reference: [HackerOne:
152
- Disclosure](https://docs.hackerone.com/hackers/disclosure.html)
153
-
154
154
  ### Secondary Contact
155
155
 
156
156
  If you do not receive an acknowledgment of your report within 6 business days,
157
157
  or if you cannot find a private security contact for the project, you may
158
- contact the OpenJS Foundation CNA at `security@lists.openjsf.org` for
159
- assistance.
158
+ contact the OpenJS Foundation CNA at <https://cna.openjsf.org/> (or
159
+ `security@lists.openjsf.org`) for assistance.
160
160
 
161
161
  The CNA can help ensure your report is properly acknowledged, assist with
162
162
  coordinating disclosure timelines, and assign CVEs when necessary. This is a
@@ -28,6 +28,7 @@ const defaultInitOptions = {
28
28
  forceCloseConnections: undefined, // keep-alive connections
29
29
  maxRequestsPerSocket: 0, // no limit
30
30
  requestTimeout: 0, // no limit
31
+ handlerTimeout: 0, // no timeout (disabled by default)
31
32
  bodyLimit: 1024 * 1024, // 1 MiB
32
33
  caseSensitive: true,
33
34
  allowUnsafeRegex: false,
@@ -72,6 +73,7 @@ const schema = {
72
73
  },
73
74
  maxRequestsPerSocket: { type: 'integer', default: defaultInitOptions.maxRequestsPerSocket, nullable: true },
74
75
  requestTimeout: { type: 'integer', default: defaultInitOptions.requestTimeout },
76
+ handlerTimeout: { type: 'integer', default: defaultInitOptions.handlerTimeout },
75
77
  bodyLimit: { type: 'integer', default: defaultInitOptions.bodyLimit },
76
78
  caseSensitive: { type: 'boolean', default: defaultInitOptions.caseSensitive },
77
79
  allowUnsafeRegex: { type: 'boolean', default: defaultInitOptions.allowUnsafeRegex },
@@ -79,7 +79,7 @@ section.
79
79
  connection plugin.
80
80
  - [`@fastify/nextjs`](https://github.com/fastify/fastify-nextjs) React
81
81
  server-side rendering support for Fastify with
82
- [Next](https://github.com/zeit/next.js/).
82
+ [Next](https://github.com/vercel/next.js/).
83
83
  - [`@fastify/oauth2`](https://github.com/fastify/fastify-oauth2) Wrap around
84
84
  [`simple-oauth2`](https://github.com/lelylan/simple-oauth2).
85
85
  - [`@fastify/one-line-logger`](https://github.com/fastify/one-line-logger) Formats
@@ -172,7 +172,7 @@ section.
172
172
  capabilities, and metrics tracking.
173
173
  - [`@blastorg/fastify-aws-dynamodb-cache`](https://github.com/blastorg/fastify-aws-dynamodb-cache)
174
174
  A plugin to help with caching API responses using AWS DynamoDB.
175
- - [`@clerk/fastify`](https://github.com/clerkinc/javascript/tree/main/packages/fastify)
175
+ - [`@clerk/fastify`](https://github.com/clerk/javascript/tree/main/packages/fastify)
176
176
  Add authentication and user management to your Fastify application with Clerk.
177
177
  - [`@coobaha/typed-fastify`](https://github.com/Coobaha/typed-fastify) Strongly
178
178
  typed routes with a runtime validation using JSON schema generated from types.
@@ -188,10 +188,6 @@ section.
188
188
  A Fastify plugin that protects against No(n)SQL injection by sanitizing data.
189
189
  - [`@exortek/remix-fastify`](https://github.com/ExorTek/remix-fastify)
190
190
  Fastify plugin for Remix.
191
- - [`@fastify-userland/request-id`](https://github.com/fastify-userland/request-id)
192
- Fastify Request ID Plugin
193
- - [`@fastify-userland/typeorm-query-runner`](https://github.com/fastify-userland/typeorm-query-runner)
194
- Fastify typeorm QueryRunner plugin
195
191
  - [`@gquittet/graceful-server`](https://github.com/gquittet/graceful-server)
196
192
  Tiny (~5k), Fast, KISS, and dependency-free Node.js library to make your
197
193
  Fastify API graceful.
@@ -205,7 +201,7 @@ section.
205
201
  Minimalistic and opinionated plugin that collects usage/process metrics and
206
202
  dispatches to [statsd](https://github.com/statsd/statsd).
207
203
  - [`@inaiat/fastify-papr`](https://github.com/inaiat/fastify-papr)
208
- A plugin to integrate [Papr](https://github.com/plexinc/papr),
204
+ A plugin to integrate [Papr](https://github.com/plexinc/papr),
209
205
  the MongoDB ORM for TypeScript & MongoDB, with Fastify.
210
206
  - [`@jerome1337/fastify-enforce-routes-pattern`](https://github.com/Jerome1337/fastify-enforce-routes-pattern)
211
207
  A Fastify plugin that enforces naming pattern for routes path.
@@ -232,7 +228,7 @@ section.
232
228
  - [`apitally`](https://github.com/apitally/apitally-js) Fastify plugin to
233
229
  integrate with [Apitally](https://apitally.io/fastify), an API analytics,
234
230
  logging and monitoring tool.
235
- - [`arecibo`](https://github.com/nucleode/arecibo) Fastify ping responder for
231
+ - [`arecibo`](https://github.com/ducktors/arecibo) Fastify ping responder for
236
232
  Kubernetes Liveness and Readiness Probes.
237
233
  - [`aws-xray-sdk-fastify`](https://github.com/aws/aws-xray-sdk-node/tree/master/sdk_contrib/fastify)
238
234
  A Fastify plugin to log requests and subsegments through AWSXray.
@@ -255,7 +251,7 @@ section.
255
251
  405 responses for routes that have a handler but not for the request's method.
256
252
  - [`fastify-amqp`](https://github.com/RafaelGSS/fastify-amqp) Fastify AMQP
257
253
  connection plugin, to use with RabbitMQ or another connector. Just a wrapper
258
- to [`amqplib`](https://github.com/squaremo/amqp.node).
254
+ to [`amqplib`](https://github.com/amqp-node/amqplib).
259
255
  - [`fastify-amqp-async`](https://github.com/kffl/fastify-amqp-async) Fastify
260
256
  AMQP plugin with a Promise-based API provided by
261
257
  [`amqplib-as-promised`](https://github.com/twawszczak/amqplib-as-promised).
@@ -265,7 +261,7 @@ section.
265
261
  for Fastify
266
262
  - [`fastify-api-key`](https://github.com/arkerone/fastify-api-key) Fastify
267
263
  plugin to authenticate HTTP requests based on API key and signature
268
- - [`fastify-appwrite`](https://github.com/Dev-Manny/fastify-appwrite) Fastify
264
+ - [`fastify-appwrite`](https://github.com/maniecodes/fastify-appwrite) Fastify
269
265
  Plugin for interacting with Appwrite server.
270
266
  - [`fastify-asyncforge`](https://github.com/mcollina/fastify-asyncforge) Plugin
271
267
  to access Fastify instance, logger, request and reply from Node.js [Async
@@ -278,8 +274,6 @@ section.
278
274
  Auth0 verification plugin for Fastify, internally uses
279
275
  [fastify-jwt](https://npm.im/fastify-jwt) and
280
276
  [jsonwebtoken](https://npm.im/jsonwebtoken).
281
- - [`fastify-autocrud`](https://github.com/paranoiasystem/fastify-autocrud)
282
- Plugin to auto-generate CRUD routes as fast as possible.
283
277
  - [`fastify-autoroutes`](https://github.com/GiovanniCardamone/fastify-autoroutes)
284
278
  Plugin to scan and load routes based on filesystem path from a custom
285
279
  directory.
@@ -374,15 +368,6 @@ section.
374
368
  [unleash](https://github.com/Unleash/unleash)).
375
369
  - [`fastify-file-routes`](https://github.com/spa5k/fastify-file-routes) Get
376
370
  Next.js based file system routing into fastify.
377
- - [`fastify-file-upload`](https://github.com/huangang/fastify-file-upload)
378
- Fastify plugin for uploading files.
379
- - [`fastify-firebase`](https://github.com/now-ims/fastify-firebase) Fastify
380
- plugin for [Firebase Admin SDK](https://firebase.google.com/docs/admin/setup)
381
- to Fastify so you can easily use Firebase Auth, Firestore, Cloud Storage,
382
- Cloud Messaging, and more.
383
- - [`fastify-firebase-auth`](https://github.com/oxsav/fastify-firebase-auth)
384
- Firebase Authentication for Fastify supporting all of the methods relating to
385
- the authentication API.
386
371
  - [`fastify-formidable`](https://github.com/climba03003/fastify-formidable)
387
372
  Handy plugin to provide multipart support and fastify-swagger integration.
388
373
  - [`fastify-gcloud-trace`](https://github.com/mkinoshi/fastify-gcloud-trace)
@@ -420,8 +405,6 @@ section.
420
405
  [node-hl7-client](https://github.com/Bugs5382/node-hl7-client) and
421
406
  [node-hl7-server](https://github.com/Bugs5382/node-hl7-server) as the
422
407
  underlining technology to do this.
423
- - [`fastify-http-client`](https://github.com/kenuyx/fastify-http-client) Plugin
424
- to send HTTP(s) requests. Built upon [urllib](https://github.com/node-modules/urllib).
425
408
  - [`fastify-http-context`](https://github.com/thorough-developer/fastify-http-context)
426
409
  Fastify plugin for "simulating" a thread of execution to allow for true HTTP
427
410
  context to take place per API call within the Fastify lifecycle of calls.
@@ -456,10 +439,6 @@ section.
456
439
  that adds support for KafkaJS - a modern Apache Kafka client library.
457
440
  - [`fastify-keycloak-adapter`](https://github.com/yubinTW/fastify-keycloak-adapter)
458
441
  A keycloak adapter for a Fastify app.
459
- - [`fastify-knexjs`](https://github.com/chapuletta/fastify-knexjs) Fastify
460
- plugin for supporting KnexJS Query Builder.
461
- - [`fastify-knexjs-mock`](https://github.com/chapuletta/fastify-knexjs-mock)
462
- Fastify Mock KnexJS for testing support.
463
442
  - [`fastify-koa`](https://github.com/rozzilla/fastify-koa) Convert Koa
464
443
  middlewares into Fastify plugins
465
444
  - [`fastify-kubernetes`](https://github.com/greguz/fastify-kubernetes) Fastify
@@ -481,8 +460,6 @@ middlewares into Fastify plugins
481
460
  - [`fastify-lured`](https://github.com/lependu/fastify-lured) Plugin to load lua
482
461
  scripts with [fastify-redis](https://github.com/fastify/fastify-redis) and
483
462
  [lured](https://github.com/enobufs/lured).
484
- A plugin to implement [Lyra](https://github.com/LyraSearch/lyra) search engine
485
- on Fastify.
486
463
  - [`fastify-mailer`](https://github.com/coopflow/fastify-mailer) Plugin to
487
464
  initialize and encapsulate [Nodemailer](https://nodemailer.com)'s transporters
488
465
  instances in Fastify.
@@ -495,8 +472,6 @@ middlewares into Fastify plugins
495
472
  exporting [Prometheus](https://prometheus.io) metrics.
496
473
  - [`fastify-minify`](https://github.com/Jelenkee/fastify-minify) Plugin for
497
474
  minification and transformation of responses.
498
- - [`fastify-mongo-memory`](https://github.com/chapuletta/fastify-mongo-memory)
499
- Fastify MongoDB in Memory Plugin for testing support.
500
475
  - [`fastify-mongodb-sanitizer`](https://github.com/KlemenKozelj/fastify-mongodb-sanitizer)
501
476
  Fastify plugin that sanitizes client input to prevent
502
477
  potential MongoDB query injection attacks.
@@ -516,8 +491,6 @@ middlewares into Fastify plugins
516
491
  for handling multipart/form-data, which is primarily used for uploading files.
517
492
  - [`fastify-multilingual`](https://github.com/gbrugger/fastify-multilingual) Unobtrusively
518
493
  decorates fastify request with Polyglot.js for i18n.
519
- - [`fastify-nats`](https://github.com/mahmed8003/fastify-nats) Plugin to share
520
- [NATS](https://nats.io) client across Fastify.
521
494
  - [`fastify-next-auth`](https://github.com/wobsoriano/fastify-next-auth)
522
495
  NextAuth.js plugin for Fastify.
523
496
  - [`fastify-no-additional-properties`](https://github.com/greguz/fastify-no-additional-properties)
@@ -531,9 +504,6 @@ middlewares into Fastify plugins
531
504
  rendering support for Fastify with Nuxt.js Framework.
532
505
  - [`fastify-oas`](https://gitlab.com/m03geek/fastify-oas) Generates OpenAPI 3.0+
533
506
  documentation from routes schemas for Fastify.
534
- - [`fastify-objectionjs`](https://github.com/jarcodallo/fastify-objectionjs)
535
- Plugin for the Fastify framework that provides integration with objectionjs
536
- ORM.
537
507
  - [`fastify-objectionjs-classes`](https://github.com/kamikazechaser/fastify-objectionjs-classes)
538
508
  Plugin to cherry-pick classes from objectionjs ORM.
539
509
  - [`fastify-opaque-apake`](https://github.com/squirrelchat/fastify-opaque-apake)
@@ -552,9 +522,6 @@ middlewares into Fastify plugins
552
522
  [`oracledb`](https://github.com/oracle/node-oracledb) connection pool to a
553
523
  Fastify server instance.
554
524
  - [`fastify-orama`](https://github.com/mateonunez/fastify-orama)
555
- - [`fastify-orientdb`](https://github.com/mahmed8003/fastify-orientdb) Fastify
556
- OrientDB connection plugin, with which you can share the OrientDB connection
557
- across every part of your server.
558
525
  - [`fastify-osm`](https://github.com/gzileni/fastify-osm) Fastify
559
526
  OSM plugin to run overpass queries by OpenStreetMap.
560
527
  - [`fastify-override`](https://github.com/matthyk/fastify-override)
@@ -626,7 +593,7 @@ middlewares into Fastify plugins
626
593
  - [`fastify-route-group`](https://github.com/TakNePoidet/fastify-route-group)
627
594
  Convenient grouping and inheritance of routes.
628
595
  - [`fastify-route-preset`](https://github.com/inyourtime/fastify-route-preset)
629
- A Fastify plugin that enables you to create route configurations that can be
596
+ A Fastify plugin that enables you to create route configurations that can be
630
597
  applied to multiple routes.
631
598
  - [`fastify-s3-buckets`](https://github.com/kibertoad/fastify-s3-buckets)
632
599
  Ensure the existence of defined S3 buckets on the application startup.
@@ -647,12 +614,8 @@ middlewares into Fastify plugins
647
614
  Fastify plugin for sending emails via AWS SES using AWS SDK v3.
648
615
  - [`fastify-shared-schema`](https://github.com/Adibla/fastify-shared-schema) Plugin
649
616
  for sharing schemas between different routes.
650
- - [`fastify-slonik`](https://github.com/Unbuttun/fastify-slonik) Fastify Slonik
651
- plugin, with this you can use slonik in every part of your server.
652
617
  - [`fastify-slow-down`](https://github.com/nearform/fastify-slow-down) A plugin
653
618
  to delay the response from the server.
654
- - [`fastify-socket.io`](https://github.com/alemagio/fastify-socket.io) a
655
- Socket.io plugin for Fastify.
656
619
  - [`fastify-split-validator`](https://github.com/MetCoder95/fastify-split-validator)
657
620
  Small plugin to allow you use multiple validators in one route based on each
658
621
  HTTP part of the request.
@@ -662,8 +625,6 @@ middlewares into Fastify plugins
662
625
  your application to a SQLite database with full Typescript support.
663
626
  - [`fastify-sse`](https://github.com/lolo32/fastify-sse) to provide Server-Sent
664
627
  Events with `reply.sse( … )` to Fastify.
665
- - [`fastify-sse-v2`](https://github.com/nodefactoryio/fastify-sse-v2) to provide
666
- Server-Sent Events using Async Iterators (supports newer versions of Fastify).
667
628
  - [`fastify-ssr-vite`](https://github.com/nineohnine/fastify-ssr-vite) A simple
668
629
  plugin for setting up server side rendering with vite.
669
630
  - [`fastify-stripe`](https://github.com/coopflow/fastify-stripe) Plugin to
@@ -675,14 +636,8 @@ middlewares into Fastify plugins
675
636
  - [`fastify-tls-keygen`](https://gitlab.com/sebdeckers/fastify-tls-keygen)
676
637
  Automatically generate a browser-compatible, trusted, self-signed,
677
638
  localhost-only, TLS certificate.
678
- - [`fastify-tokenize`](https://github.com/Bowser65/fastify-tokenize)
679
- [Tokenize](https://github.com/Bowser65/Tokenize) plugin for Fastify that
680
- removes the pain of managing authentication tokens, with built-in integration
681
- for `fastify-auth`.
682
639
  - [`fastify-totp`](https://github.com/beliven-it/fastify-totp) A plugin to handle
683
640
  TOTP (e.g. for 2FA).
684
- - [`fastify-twitch-ebs-tools`](https://github.com/lukemnet/fastify-twitch-ebs-tools)
685
- Useful functions for Twitch Extension Backend Services (EBS).
686
641
  - [`fastify-type-provider-effect-schema`](https://github.com/daotl/fastify-type-provider-effect-schema)
687
642
  Fastify
688
643
  [type provider](https://fastify.dev/docs/latest/Reference/Type-Providers/)
@@ -701,8 +656,6 @@ middlewares into Fastify plugins
701
656
  subdomain HTTP requests to another server (useful if you want to point
702
657
  multiple subdomains to the same IP address, while running different servers on
703
658
  the same machine).
704
- - [`fastify-vite`](https://github.com/galvez/fastify-vite)
705
- [Vite](https://vitejs.dev/) plugin for Fastify with SSR data support.
706
659
  - [`fastify-vue-plugin`](https://github.com/TheNoim/fastify-vue)
707
660
  [Nuxt.js](https://nuxtjs.org) plugin for Fastify. Control the routes nuxt
708
661
  should use.
@@ -745,13 +698,9 @@ middlewares into Fastify plugins
745
698
  plugin to easily create Google Cloud PubSub endpoints.
746
699
  - [`sequelize-fastify`](https://github.com/hsynlms/sequelize-fastify) A simple
747
700
  and lightweight Sequelize plugin for Fastify.
748
- - [`typeorm-fastify-plugin`](https://github.com/jclemens24/fastify-typeorm) A simple
749
- and updated Typeorm plugin for use with Fastify.
750
701
 
751
702
  #### [Community Tools](#community-tools)
752
703
 
753
- - [`@fastify-userland/workflows`](https://github.com/fastify-userland/workflows)
754
- Reusable workflows for use in the Fastify plugin
755
704
  - [`fast-maker`](https://github.com/imjuni/fast-maker) route configuration
756
705
  generator by directory structure.
757
706
  - [`fastify-flux`](https://github.com/Jnig/fastify-flux) Tool for building
@@ -765,4 +714,3 @@ middlewares into Fastify plugins
765
714
  Fastify plugin for Vite with Hot-module Replacement.
766
715
  - [`vite-plugin-fastify-routes`](https://github.com/Vanilla-IceCream/vite-plugin-fastify-routes)
767
716
  File-based routing for Fastify applications using Vite.
768
-
@@ -122,5 +122,6 @@ const schema = { body: bodyJsonSchema }
122
122
  fastify.post('/the/url', { schema }, handler)
123
123
  ```
124
124
 
125
- > ℹ️ Note: You can mix up the `$ref-way` and the `replace-way`
125
+ > ℹ️ Note:
126
+ > You can mix up the `$ref-way` and the `replace-way`
126
127
  > when using `fastify.addSchema`.
@@ -83,8 +83,8 @@ If you need to use middleware, use
83
83
  continue to be maintained.
84
84
  However, it is strongly recommended that you migrate to Fastify's [hooks](../Reference/Hooks.md).
85
85
 
86
- > **Note**: Codemod remove `app.use()` with:
87
- >
86
+ > ℹ️ Note:
87
+ > Codemod remove `app.use()` with:
88
88
  > ```bash
89
89
  > npx codemod@latest fastify/4/remove-app-use
90
90
  > ```
@@ -94,8 +94,8 @@ However, it is strongly recommended that you migrate to Fastify's [hooks](../Ref
94
94
  If you previously used the `reply.res` attribute to access the underlying Request
95
95
  object you will now need to use `reply.raw`.
96
96
 
97
- > **Note**: Codemod `reply.res` to `reply.raw` with:
98
- >
97
+ > ℹ️ Note:
98
+ > Codemod `reply.res` to `reply.raw` with:
99
99
  > ```bash
100
100
  > npx codemod@latest fastify/4/reply-raw-access
101
101
  > ```
@@ -146,8 +146,9 @@ As a result, if you specify an `onRoute` hook in a plugin you should now either:
146
146
  done();
147
147
  });
148
148
  ```
149
- > **Note**: Codemod synchronous route definitions with:
150
- >
149
+
150
+ > ℹ️ Note:
151
+ > Codemod synchronous route definitions with:
151
152
  > ```bash
152
153
  > npx codemod@latest fastify/4/wrap-routes-plugin
153
154
  > ```
@@ -176,8 +177,8 @@ As a result, if you specify an `onRoute` hook in a plugin you should now either:
176
177
  });
177
178
  ```
178
179
 
179
- > **Note**: Codemod 'await register(...)' with:
180
- >
180
+ > ℹ️ Note:
181
+ > Codemod 'await register(...)' with:
181
182
  > ```bash
182
183
  > npx codemod@latest fastify/4/await-register-calls
183
184
  > ```
@@ -550,7 +550,7 @@ so you should have already updated your code.
550
550
  The updated AJV compiler updates `ajv-formats` which now
551
551
  enforce the use of timezone in `time` and `date-time` format.
552
552
  A workaround is to use `iso-time` and `iso-date-time` formats
553
- which support an optional timezone for backwards compatibility.
553
+ which support an optional timezone for backwards compatibility.
554
554
  See the
555
555
  [full discussion](https://github.com/fastify/fluent-json-schema/issues/267).
556
556
 
@@ -601,4 +601,4 @@ https://vercel.com/templates/backend/fastify-on-vercel).
601
601
  [Fluid compute](https://vercel.com/docs/functions/fluid-compute) currently
602
602
  requires an explicit opt-in. Learn more about enabling Fluid compute
603
603
  [here](
604
- https://vercel.com/docs/functions/fluid-compute#how-to-enable-fluid-compute).
604
+ https://vercel.com/docs/fluid-compute#enabling-fluid-compute).
@@ -152,7 +152,8 @@ fastify.addContentTypeParser('text/xml', function (request, payload, done) {
152
152
  })
153
153
  ```
154
154
 
155
- > ℹ️ Note: `function(req, done)` and `async function(req)` are
155
+ > ℹ️ Note:
156
+ > `function(req, done)` and `async function(req)` are
156
157
  > still supported but deprecated.
157
158
 
158
159
  #### Body Parser
@@ -399,7 +399,8 @@ fastify.register(async function (fastify) {
399
399
  })
400
400
  ```
401
401
 
402
- > ℹ️ Note: For TypeScript users, `getDecorator` supports generic type parameters.
402
+ > ℹ️ Note:
403
+ > For TypeScript users, `getDecorator` supports generic type parameters.
403
404
  > See the [TypeScript documentation](/docs/Reference/TypeScript.md) for
404
405
  > advanced typing examples.
405
406
 
@@ -429,6 +430,7 @@ fastify.addHook('preHandler', async (req, reply) => {
429
430
  })
430
431
  ```
431
432
 
432
- > ℹ️ Note: For TypeScript users, see the
433
+ > ℹ️ Note:
434
+ > For TypeScript users, see the
433
435
  > [TypeScript documentation](/docs/Reference/TypeScript.md) for advanced
434
436
  > typing examples using `setDecorator<T>`.
@@ -84,6 +84,9 @@
84
84
  - [FST_ERR_ROUTE_METHOD_NOT_SUPPORTED](#fst_err_route_method_not_supported)
85
85
  - [FST_ERR_ROUTE_BODY_VALIDATION_SCHEMA_NOT_SUPPORTED](#fst_err_route_body_validation_schema_not_supported)
86
86
  - [FST_ERR_ROUTE_BODY_LIMIT_OPTION_NOT_INT](#fst_err_route_body_limit_option_not_int)
87
+ - [FST_ERR_HANDLER_TIMEOUT](#fst_err_handler_timeout)
88
+
89
+ - [FST_ERR_ROUTE_HANDLER_TIMEOUT_OPTION_NOT_INT](#fst_err_route_handler_timeout_option_not_int)
87
90
  - [FST_ERR_ROUTE_REWRITE_NOT_STR](#fst_err_route_rewrite_not_str)
88
91
  - [FST_ERR_REOPENED_CLOSE_SERVER](#fst_err_reopened_close_server)
89
92
  - [FST_ERR_REOPENED_SERVER](#fst_err_reopened_server)
@@ -356,6 +359,8 @@ Below is a table with all the error codes used by Fastify.
356
359
  | <a id="fst_err_route_method_not_supported">FST_ERR_ROUTE_METHOD_NOT_SUPPORTED</a> | Method is not supported for the route. | Use a supported method. | [#4554](https://github.com/fastify/fastify/pull/4554) |
357
360
  | <a id="fst_err_route_body_validation_schema_not_supported">FST_ERR_ROUTE_BODY_VALIDATION_SCHEMA_NOT_SUPPORTED</a> | Body validation schema route is not supported. | Use a different different method for the route. | [#4554](https://github.com/fastify/fastify/pull/4554) |
358
361
  | <a id="fst_err_route_body_limit_option_not_int">FST_ERR_ROUTE_BODY_LIMIT_OPTION_NOT_INT</a> | `bodyLimit` option must be an integer. | Use an integer for the `bodyLimit` option. | [#4554](https://github.com/fastify/fastify/pull/4554) |
362
+ | <a id="fst_err_handler_timeout">FST_ERR_HANDLER_TIMEOUT</a> | Request timed out. | Increase the `handlerTimeout` option or optimize the handler. | - |
363
+ | <a id="fst_err_route_handler_timeout_option_not_int">FST_ERR_ROUTE_HANDLER_TIMEOUT_OPTION_NOT_INT</a> | `handlerTimeout` option must be a positive integer. | Use a positive integer for the `handlerTimeout` option. | - |
359
364
  | <a id="fst_err_route_rewrite_not_str">FST_ERR_ROUTE_REWRITE_NOT_STR</a> | `rewriteUrl` needs to be of type `string`. | Use a string for the `rewriteUrl`. | [#4554](https://github.com/fastify/fastify/pull/4554) |
360
365
  | <a id="fst_err_reopened_close_server">FST_ERR_REOPENED_CLOSE_SERVER</a> | Fastify has already been closed and cannot be reopened. | - | [#2415](https://github.com/fastify/fastify/pull/2415) |
361
366
  | <a id="fst_err_reopened_server">FST_ERR_REOPENED_SERVER</a> | Fastify is already listening. | - | [#2415](https://github.com/fastify/fastify/pull/2415) |