@gasket/plugin-fastify 7.5.4 → 7.5.5

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.
package/README.md CHANGED
@@ -115,6 +115,10 @@ export default {
115
115
 
116
116
  This plugins hooks the [createServers] lifecycles from [@gasket/plugin-https].
117
117
 
118
+ ## Guides
119
+
120
+ - [Removing @fastify/express] - Migration guide for removing `@fastify/express` dependency and using native Fastify patterns
121
+
118
122
  ## License
119
123
 
120
124
  [MIT](./LICENSE.md)
@@ -123,3 +127,4 @@ This plugins hooks the [createServers] lifecycles from [@gasket/plugin-https].
123
127
 
124
128
  [@gasket/plugin-https]:/packages/gasket-plugin-https/README.md
125
129
  [createServers]:/packages/gasket-plugin-https/README.md#createservers
130
+ [Removing @fastify/express]:docs/remove-fastify-express.md
@@ -35,7 +35,13 @@ async function createServers(gasket, serverOpts) {
35
35
  ...serverOpts,
36
36
  handler: async function handler(...args) {
37
37
  await app.ready();
38
- app.server.emit('request', ...args);
38
+ // Invoke Fastify's request listeners directly instead of emitting 'request'
39
+ // on app.server. Emit would cause OpenTelemetry HTTP instrumentation to
40
+ // record a second "incoming request" for the same req/res (double trace).
41
+ const listeners = app.server.listeners('request');
42
+ for (const listener of listeners){
43
+ listener.apply(app.server, args);
44
+ }
39
45
  }
40
46
  };
41
47
  }
@@ -36,7 +36,13 @@ export default async function createServers(gasket, serverOpts) {
36
36
  ...serverOpts,
37
37
  handler: async function handler(...args) {
38
38
  await app.ready();
39
- app.server.emit('request', ...args);
39
+ // Invoke Fastify's request listeners directly instead of emitting 'request'
40
+ // on app.server. Emit would cause OpenTelemetry HTTP instrumentation to
41
+ // record a second "incoming request" for the same req/res (double trace).
42
+ const listeners = app.server.listeners('request');
43
+ for (const listener of listeners) {
44
+ listener.apply(app.server, args);
45
+ }
40
46
  }
41
47
  };
42
48
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gasket/plugin-fastify",
3
- "version": "7.5.4",
3
+ "version": "7.5.5",
4
4
  "description": "Adds fastify support to your application",
5
5
  "type": "module",
6
6
  "main": "./lib/index.js",
@@ -40,8 +40,8 @@
40
40
  "fastify": "^4.29.1",
41
41
  "vitest": "^3.2.0",
42
42
  "@gasket/cjs": "^7.1.2",
43
- "@gasket/core": "^7.7.4",
44
43
  "@gasket/plugin-https": "^7.4.2",
44
+ "@gasket/core": "^7.7.4",
45
45
  "@gasket/plugin-logger": "^7.4.0",
46
46
  "@gasket/plugin-metadata": "^7.5.10",
47
47
  "create-gasket-app": "^7.4.21"