Skip to content

Commit 21cdd7f

Browse files
authored
Merge branch 'main' into test/close-all-connections
2 parents f7536c2 + 0c18914 commit 21cdd7f

27 files changed

+1253
-1140
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
branches:
66
- main
77
- next
8-
- 'v*'
8+
- '*.x'
99
paths-ignore:
1010
- 'docs/**'
1111
- '*.md'
@@ -193,13 +193,13 @@ jobs:
193193
npm install --ignore-scripts
194194
- name: install webpack stack
195195
run: |
196-
cd test/bundler/webpack && npm install
196+
cd test/bundler/webpack && npm install --ignore-scripts
197197
- name: Test webpack bundle
198198
run: |
199199
cd test/bundler/webpack && npm run test
200200
- name: install esbuild stack
201201
run: |
202-
cd test/bundler/esbuild && npm install
202+
cd test/bundler/esbuild && npm install --ignore-scripts
203203
- name: Test esbuild bundle
204204
run: |
205205
cd test/bundler/esbuild && npm run test

.github/workflows/citgm-package.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ jobs:
8787
- name: Install Dependencies for ${{inputs.package}}
8888
working-directory: package
8989
run: |
90-
npm install
90+
npm install --ignore-scripts
9191
- name: Sym Link Fastify
9292
working-directory: package
9393
run: |

.github/workflows/integration-alternative-runtimes.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ jobs:
5151

5252
- name: Install Production
5353
run: |
54-
pnpm install --prod
54+
pnpm install --ignore-scripts --prod
5555
5656
- name: Run server
5757
run: |

.github/workflows/integration.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747

4848
- name: Install Production
4949
run: |
50-
pnpm install --prod
50+
pnpm install --ignore-scripts --prod
5151
5252
- name: Run server
5353
run: |

.github/workflows/package-manager-ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
with:
3838
version: ${{ matrix.pnpm-version }}
3939

40-
- run: pnpm install
40+
- run: pnpm install --ignore-scripts
4141

4242
- name: Run tests
4343
run: |
@@ -70,7 +70,7 @@ jobs:
7070
- name: Install with yarn
7171
run: |
7272
curl -o- -L https://yarnpkg.com/install.sh | bash
73-
yarn install --ignore-engines
73+
yarn install --ignore-engines --ignore-scripts
7474
7575
- run: yarn
7676

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
ignore-scripts=true
12
package-lock=false

docs/Guides/Ecosystem.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ section.
4040
plugin for adding
4141
[CSRF](https://en.wikipedia.org/wiki/Cross-site_request_forgery) protection to
4242
Fastify.
43-
- [`@fastify/diagnostics-channel`](https://github.com/fastify/fastify-diagnostics-channel)
44-
Plugin to deal with `diagnostics_channel` on Fastify.
4543
- [`@fastify/elasticsearch`](https://github.com/fastify/fastify-elasticsearch)
4644
Plugin to share the same ES client.
4745
- [`@fastify/env`](https://github.com/fastify/fastify-env) Load and check
@@ -740,9 +738,13 @@ middlewares into Fastify plugins
740738
generator by directory structure.
741739
- [`fastify-flux`](https://github.com/Jnig/fastify-flux) Tool for building
742740
Fastify APIs using decorators and convert Typescript interface to JSON Schema.
741+
- [`jeasx`](https://www.jeasx.dev)
742+
A flexible server-rendering framework built on Fastify
743+
that leverages asynchronous JSX to simplify web development.
743744
- [`simple-tjscli`](https://github.com/imjuni/simple-tjscli) CLI tool to
744745
generate JSON Schema from TypeScript interfaces.
745746
- [`vite-plugin-fastify`](https://github.com/Vanilla-IceCream/vite-plugin-fastify)
746747
Fastify plugin for Vite with Hot-module Replacement.
747748
- [`vite-plugin-fastify-routes`](https://github.com/Vanilla-IceCream/vite-plugin-fastify-routes)
748749
File-based routing for Fastify applications using Vite.
750+

docs/Reference/Errors.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@
6969
- [FST_ERR_SCH_VALIDATION_BUILD](#fst_err_sch_validation_build)
7070
- [FST_ERR_SCH_SERIALIZATION_BUILD](#fst_err_sch_serialization_build)
7171
- [FST_ERR_SCH_RESPONSE_SCHEMA_NOT_NESTED_2XX](#fst_err_sch_response_schema_not_nested_2xx)
72-
- [FST_ERR_HTTP2_INVALID_VERSION](#fst_err_http2_invalid_version)
7372
- [FST_ERR_INIT_OPTS_INVALID](#fst_err_init_opts_invalid)
7473
- [FST_ERR_FORCE_CLOSE_CONNECTIONS_IDLE_NOT_AVAILABLE](#fst_err_force_close_connections_idle_not_available)
7574
- [FST_ERR_DUPLICATED_ROUTE](#fst_err_duplicated_route)
@@ -340,7 +339,6 @@ Below is a table with all the error codes used by Fastify.
340339
| <a id="fst_err_sch_validation_build">FST_ERR_SCH_VALIDATION_BUILD</a> | The JSON schema provided for validation to a route is not valid. | Fix the JSON schema. | [#2023](https://github.com/fastify/fastify/pull/2023) |
341340
| <a id="fst_err_sch_serialization_build">FST_ERR_SCH_SERIALIZATION_BUILD</a> | The JSON schema provided for serialization of a route response is not valid. | Fix the JSON schema. | [#2023](https://github.com/fastify/fastify/pull/2023) |
342341
| <a id="fst_err_sch_response_schema_not_nested_2xx">FST_ERR_SCH_RESPONSE_SCHEMA_NOT_NESTED_2XX</a> | Response schemas should be nested under a valid status code (2XX). | Use a valid status code. | [#4554](https://github.com/fastify/fastify/pull/4554) |
343-
| <a id="fst_err_http2_invalid_version">FST_ERR_HTTP2_INVALID_VERSION</a> | HTTP2 is available only from node >= 8.8.1. | Use a higher version of node. | [#1346](https://github.com/fastify/fastify/pull/1346) |
344342
| <a id="fst_err_init_opts_invalid">FST_ERR_INIT_OPTS_INVALID</a> | Invalid initialization options. | Use valid initialization options. | [#1471](https://github.com/fastify/fastify/pull/1471) |
345343
| <a id="fst_err_force_close_connections_idle_not_available">FST_ERR_FORCE_CLOSE_CONNECTIONS_IDLE_NOT_AVAILABLE</a> | Cannot set forceCloseConnections to `idle` as your HTTP server does not support `closeIdleConnections` method. | Use a different value for `forceCloseConnections`. | [#3925](https://github.com/fastify/fastify/pull/3925) |
346344
| <a id="fst_err_duplicated_route">FST_ERR_DUPLICATED_ROUTE</a> | The HTTP method already has a registered controller for that URL. | Use a different URL or register the controller for another HTTP method. | [#2954](https://github.com/fastify/fastify/pull/2954) |

docs/Reference/Server.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1529,7 +1529,7 @@ plugins.
15291529
> 🛈 Note:
15301530
> Some config properties from the request object will be
15311531
> undefined inside the custom not found handler. E.g.:
1532-
> `request.routerPath`, `routerMethod` and `context.config`.
1532+
> `request.routeOptions.url`, `routeOptions.method` and `routeOptions.config`.
15331533
> This method design goal is to allow calling the common not found route.
15341534
> To return a per-route customized 404 response, you can do it in
15351535
> the response itself.
@@ -1574,6 +1574,22 @@ if (statusCode >= 500) {
15741574
log.error(error)
15751575
}
15761576
```
1577+
1578+
> ⚠ Warning:
1579+
> Avoid calling setErrorHandler multiple times in the same scope.
1580+
> Only the last handler will take effect, and previous ones will be silently overridden.
1581+
>
1582+
> Incorrect usage:
1583+
> ```js
1584+
> app.setErrorHandler(function freeSomeResources () {
1585+
> // Never executed, memory leaks
1586+
> })
1587+
>
1588+
> app.setErrorHandler(function anotherErrorHandler () {
1589+
> // Overrides the previous handler
1590+
> })
1591+
> ```
1592+
15771593
#### setChildLoggerFactory
15781594
<a id="set-child-logger-factory"></a>
15791595

fastify.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -681,8 +681,12 @@ function fastify (options) {
681681
this[kHooks].add(name, fn)
682682
} else {
683683
this.after((err, done) => {
684-
_addHook.call(this, name, fn)
685-
done(err)
684+
try {
685+
_addHook.call(this, name, fn)
686+
done(err)
687+
} catch (err) {
688+
done(err)
689+
}
686690
})
687691
}
688692
return this

0 commit comments

Comments
 (0)