@depup/sentry__node 10.72.0-depup.1 → 10.73.0-depup.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.
- package/README.md +4 -4
- package/build/cjs/integrations/tracing/express.js +4 -0
- package/build/cjs/integrations/tracing/express.js.map +1 -1
- package/build/cjs/integrations/tracing/fastify/index.js.map +1 -1
- package/build/esm/integrations/tracing/express.js +4 -0
- package/build/esm/integrations/tracing/express.js.map +1 -1
- package/build/esm/integrations/tracing/fastify/index.js.map +1 -1
- package/build/esm/package.json +1 -1
- package/build/types/integrations/tracing/express.d.ts.map +1 -1
- package/build/types/integrations/tracing/fastify/index.d.ts +27 -22
- package/build/types/integrations/tracing/fastify/index.d.ts.map +1 -1
- package/build/types-ts3.8/integrations/tracing/fastify/index.d.ts +27 -22
- package/changes.json +3 -3
- package/package.json +11 -11
package/README.md
CHANGED
|
@@ -13,8 +13,8 @@ npm install @depup/sentry__node
|
|
|
13
13
|
|
|
14
14
|
| Field | Value |
|
|
15
15
|
|-------|-------|
|
|
16
|
-
| Original | [@sentry/node](https://www.npmjs.com/package/@sentry/node) @ 10.
|
|
17
|
-
| Processed | 2026-
|
|
16
|
+
| Original | [@sentry/node](https://www.npmjs.com/package/@sentry/node) @ 10.73.0 |
|
|
17
|
+
| Processed | 2026-09-01 |
|
|
18
18
|
| Smoke test | passed |
|
|
19
19
|
| Deps updated | 4 |
|
|
20
20
|
|
|
@@ -22,8 +22,8 @@ npm install @depup/sentry__node
|
|
|
22
22
|
|
|
23
23
|
| Dependency | From | To |
|
|
24
24
|
|------------|------|-----|
|
|
25
|
-
| @opentelemetry/instrumentation | ^0.220.0 | ^0.
|
|
26
|
-
| @opentelemetry/sdk-trace-base | ^2.9.0 | ^2.
|
|
25
|
+
| @opentelemetry/instrumentation | ^0.220.0 | ^0.222.0 |
|
|
26
|
+
| @opentelemetry/sdk-trace-base | ^2.9.0 | ^2.11.0 |
|
|
27
27
|
| @sentry/conventions | ^0.16.0 | ^0.21.0 |
|
|
28
28
|
| import-in-the-middle | ^3.0.0 | ^3.4.0 |
|
|
29
29
|
|
|
@@ -50,6 +50,10 @@ const _expressIntegration = ((options) => {
|
|
|
50
50
|
name: INTEGRATION_NAME,
|
|
51
51
|
setupOnce() {
|
|
52
52
|
instrumentExpress(options);
|
|
53
|
+
},
|
|
54
|
+
// Read back by `expressErrorHandler` in `@sentry/core`, which is what captures Express errors.
|
|
55
|
+
getShouldHandleError() {
|
|
56
|
+
return options?.shouldHandleError;
|
|
53
57
|
}
|
|
54
58
|
};
|
|
55
59
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"express.js","sources":["../../../../src/integrations/tracing/express.ts"],"sourcesContent":["// Automatic istrumentation for Express using OTel\nimport type { InstrumentationConfig } from '@opentelemetry/instrumentation';\nimport { InstrumentationBase, InstrumentationNodeModuleDefinition } from '@opentelemetry/instrumentation';\n\nimport { ensureIsWrapped, generateInstrumentOnce } from '@sentry/node-core';\nimport {\n type ExpressIntegrationOptions,\n type IntegrationFn,\n debug,\n patchExpressModule,\n SDK_VERSION,\n defineIntegration,\n setupExpressErrorHandler as coreSetupExpressErrorHandler,\n type ExpressHandlerOptions,\n} from '@sentry/core';\nexport { expressErrorHandler } from '@sentry/core';\nimport { DEBUG_BUILD } from '../../debug-build';\nimport { setHttpServerSpanRouteAttribute } from '../../utils/setHttpServerSpanRouteAttribute';\n\nconst INTEGRATION_NAME = 'Express' as const;\nconst SUPPORTED_VERSIONS = ['>=4.0.0 <6'];\n\nexport function setupExpressErrorHandler(\n //oxlint-disable-next-line no-explicit-any\n app: { use: (middleware: any) => unknown },\n options?: ExpressHandlerOptions,\n): void {\n coreSetupExpressErrorHandler(app, options);\n ensureIsWrapped(app.use, 'express');\n}\n\nexport type ExpressInstrumentationConfig = InstrumentationConfig &\n Omit<ExpressIntegrationOptions, 'express' | 'onRouteResolved'>;\n\nexport const instrumentExpress = generateInstrumentOnce(\n INTEGRATION_NAME,\n (options?: ExpressInstrumentationConfig) => new ExpressInstrumentation(options),\n);\n\nexport class ExpressInstrumentation extends InstrumentationBase<ExpressInstrumentationConfig> {\n public constructor(config: ExpressInstrumentationConfig = {}) {\n super('sentry-express', SDK_VERSION, config);\n }\n public init(): InstrumentationNodeModuleDefinition {\n const module = new InstrumentationNodeModuleDefinition(\n 'express',\n SUPPORTED_VERSIONS,\n express => {\n try {\n patchExpressModule(express, () => ({\n ...this.getConfig(),\n onRouteResolved(route) {\n if (route) {\n setHttpServerSpanRouteAttribute(route);\n }\n },\n }));\n } catch (e) {\n DEBUG_BUILD && debug.error('Failed to patch express module:', e);\n }\n return express;\n },\n // we do not ever actually unpatch in our SDKs\n express => express,\n );\n return module;\n }\n}\nconst _expressIntegration = ((options?: ExpressInstrumentationConfig) => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentExpress(options);\n },\n };\n}) satisfies IntegrationFn;\n\nexport const expressIntegration = defineIntegration(_expressIntegration);\n"],"names":["coreSetupExpressErrorHandler","ensureIsWrapped","generateInstrumentOnce","InstrumentationBase","SDK_VERSION","InstrumentationNodeModuleDefinition","patchExpressModule","setHttpServerSpanRouteAttribute","DEBUG_BUILD","debug","defineIntegration"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"express.js","sources":["../../../../src/integrations/tracing/express.ts"],"sourcesContent":["// Automatic istrumentation for Express using OTel\nimport type { InstrumentationConfig } from '@opentelemetry/instrumentation';\nimport { InstrumentationBase, InstrumentationNodeModuleDefinition } from '@opentelemetry/instrumentation';\n\nimport { ensureIsWrapped, generateInstrumentOnce } from '@sentry/node-core';\nimport {\n type ExpressIntegration,\n type ExpressIntegrationOptions,\n type IntegrationFn,\n debug,\n patchExpressModule,\n SDK_VERSION,\n defineIntegration,\n setupExpressErrorHandler as coreSetupExpressErrorHandler,\n type ExpressHandlerOptions,\n} from '@sentry/core';\nexport { expressErrorHandler } from '@sentry/core';\nimport { DEBUG_BUILD } from '../../debug-build';\nimport { setHttpServerSpanRouteAttribute } from '../../utils/setHttpServerSpanRouteAttribute';\n\nconst INTEGRATION_NAME = 'Express' as const;\nconst SUPPORTED_VERSIONS = ['>=4.0.0 <6'];\n\nexport function setupExpressErrorHandler(\n //oxlint-disable-next-line no-explicit-any\n app: { use: (middleware: any) => unknown },\n options?: ExpressHandlerOptions,\n): void {\n coreSetupExpressErrorHandler(app, options);\n ensureIsWrapped(app.use, 'express');\n}\n\nexport type ExpressInstrumentationConfig = InstrumentationConfig &\n Omit<ExpressIntegrationOptions, 'express' | 'onRouteResolved'>;\n\nexport const instrumentExpress = generateInstrumentOnce(\n INTEGRATION_NAME,\n (options?: ExpressInstrumentationConfig) => new ExpressInstrumentation(options),\n);\n\nexport class ExpressInstrumentation extends InstrumentationBase<ExpressInstrumentationConfig> {\n public constructor(config: ExpressInstrumentationConfig = {}) {\n super('sentry-express', SDK_VERSION, config);\n }\n public init(): InstrumentationNodeModuleDefinition {\n const module = new InstrumentationNodeModuleDefinition(\n 'express',\n SUPPORTED_VERSIONS,\n express => {\n try {\n patchExpressModule(express, () => ({\n ...this.getConfig(),\n onRouteResolved(route) {\n if (route) {\n setHttpServerSpanRouteAttribute(route);\n }\n },\n }));\n } catch (e) {\n DEBUG_BUILD && debug.error('Failed to patch express module:', e);\n }\n return express;\n },\n // we do not ever actually unpatch in our SDKs\n express => express,\n );\n return module;\n }\n}\nconst _expressIntegration = ((options?: ExpressInstrumentationConfig) => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentExpress(options);\n },\n // Read back by `expressErrorHandler` in `@sentry/core`, which is what captures Express errors.\n getShouldHandleError() {\n return options?.shouldHandleError;\n },\n } satisfies ExpressIntegration;\n}) satisfies IntegrationFn;\n\nexport const expressIntegration = defineIntegration(_expressIntegration);\n"],"names":["coreSetupExpressErrorHandler","ensureIsWrapped","generateInstrumentOnce","InstrumentationBase","SDK_VERSION","InstrumentationNodeModuleDefinition","patchExpressModule","setHttpServerSpanRouteAttribute","DEBUG_BUILD","debug","defineIntegration"],"mappings":";;;;;;;;AAoBA,MAAM,gBAAA,GAAmB,SAAA;AACzB,MAAM,kBAAA,GAAqB,CAAC,YAAY,CAAA;AAEjC,SAAS,wBAAA,CAEd,KACA,OAAA,EACM;AACN,EAAAA,6BAAA,CAA6B,KAAK,OAAO,CAAA;AACzC,EAAAC,wBAAA,CAAgB,GAAA,CAAI,KAAK,SAAS,CAAA;AACpC;AAKO,MAAM,iBAAA,GAAoBC,+BAAA;AAAA,EAC/B,gBAAA;AAAA,EACA,CAAC,OAAA,KAA2C,IAAI,sBAAA,CAAuB,OAAO;AAChF;AAEO,MAAM,+BAA+BC,mCAAA,CAAkD;AAAA,EACrF,WAAA,CAAY,MAAA,GAAuC,EAAC,EAAG;AAC5D,IAAA,KAAA,CAAM,gBAAA,EAAkBC,kBAAa,MAAM,CAAA;AAAA,EAC7C;AAAA,EACO,IAAA,GAA4C;AACjD,IAAA,MAAM,SAAS,IAAIC,mDAAA;AAAA,MACjB,SAAA;AAAA,MACA,kBAAA;AAAA,MACA,CAAA,OAAA,KAAW;AACT,QAAA,IAAI;AACF,UAAAC,uBAAA,CAAmB,SAAS,OAAO;AAAA,YACjC,GAAG,KAAK,SAAA,EAAU;AAAA,YAClB,gBAAgB,KAAA,EAAO;AACrB,cAAA,IAAI,KAAA,EAAO;AACT,gBAAAC,+DAAA,CAAgC,KAAK,CAAA;AAAA,cACvC;AAAA,YACF;AAAA,WACF,CAAE,CAAA;AAAA,QACJ,SAAS,CAAA,EAAG;AACV,UAAAC,sBAAA,IAAeC,UAAA,CAAM,KAAA,CAAM,iCAAA,EAAmC,CAAC,CAAA;AAAA,QACjE;AACA,QAAA,OAAO,OAAA;AAAA,MACT,CAAA;AAAA;AAAA,MAEA,CAAA,OAAA,KAAW;AAAA,KACb;AACA,IAAA,OAAO,MAAA;AAAA,EACT;AACF;AACA,MAAM,mBAAA,IAAuB,CAAC,OAAA,KAA2C;AACvE,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,gBAAA;AAAA,IACN,SAAA,GAAY;AACV,MAAA,iBAAA,CAAkB,OAAO,CAAA;AAAA,IAC3B,CAAA;AAAA;AAAA,IAEA,oBAAA,GAAuB;AACrB,MAAA,OAAO,OAAA,EAAS,iBAAA;AAAA,IAClB;AAAA,GACF;AACF,CAAA,CAAA;AAEO,MAAM,kBAAA,GAAqBC,uBAAkB,mBAAmB;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../src/integrations/tracing/fastify/index.ts"],"sourcesContent":["import type { Integration, IntegrationFn } from '@sentry/core';\nimport { defineIntegration, extendIntegration, getClient } from '@sentry/core';\nimport { generateInstrumentOnce } from '@sentry/node-core';\nimport type { FastifyInstance, FastifyMinimal, FastifyReply, FastifyRequest } from './types';\nimport { FastifyInstrumentationV3 } from './v3/instrumentation';\nimport {\n fastifyIntegration as serverUtilsFastifyIntegration,\n instrumentFastify,\n handleFastifyError,\n} from '@sentry/server-utils';\n\ninterface FastifyIntegration extends Integration {\n getShouldHandleError: () => (error: Error, request: FastifyRequest, reply: FastifyReply) => boolean;\n // todo(v11): Remove this\n setShouldHandleError: (\n shouldHandleError: (error: Error, request: FastifyRequest, reply: FastifyReply) => boolean,\n ) => void;\n}\n\n// oxlint-disable-next-line typescript/no-deprecated\nexport { instrumentFastify };\n\n/**\n * Options for the Fastify integration.\n *\n * `shouldHandleError` - Callback method deciding whether error should be captured and sent to Sentry\n
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../src/integrations/tracing/fastify/index.ts"],"sourcesContent":["import type { Integration, IntegrationFn } from '@sentry/core';\nimport { defineIntegration, extendIntegration, getClient } from '@sentry/core';\nimport { generateInstrumentOnce } from '@sentry/node-core';\nimport type { FastifyInstance, FastifyMinimal, FastifyReply, FastifyRequest } from './types';\nimport { FastifyInstrumentationV3 } from './v3/instrumentation';\nimport {\n fastifyIntegration as serverUtilsFastifyIntegration,\n instrumentFastify,\n handleFastifyError,\n} from '@sentry/server-utils';\n\ninterface FastifyIntegration extends Integration {\n getShouldHandleError: () => (error: Error, request: FastifyRequest, reply: FastifyReply) => boolean;\n // todo(v11): Remove this\n setShouldHandleError: (\n shouldHandleError: (error: Error, request: FastifyRequest, reply: FastifyReply) => boolean,\n ) => void;\n}\n\n// oxlint-disable-next-line typescript/no-deprecated\nexport { instrumentFastify };\n\n/**\n * Options for the Fastify integration.\n *\n * `shouldHandleError` - Callback method deciding whether error should be captured and sent to Sentry\n *\n * @example\n *\n * ```javascript\n * Sentry.init({\n * integrations: [\n * Sentry.fastifyIntegration({\n * shouldHandleError(_error, _request, reply) {\n * return reply.statusCode >= 500;\n * },\n * });\n * },\n * });\n * ```\n *\n */\ninterface FastifyIntegrationOptions {\n /**\n * Callback method deciding whether error should be captured and sent to Sentry\n * This is used on Fastify v5 where Sentry handles errors in the diagnostics channel.\n * Fastify v3 and v4 use `setupFastifyErrorHandler` instead.\n *\n * @param error Captured Fastify error\n * @param request Fastify request (or any object containing at least method, routeOptions.url, and routerPath)\n * @param reply Fastify reply (or any object containing at least statusCode)\n *\n * @example\n *\n * If using TypeScript, you can cast the request and reply to get full type safety.\n *\n * ```typescript\n * import type { FastifyRequest, FastifyReply } from 'fastify';\n *\n * Sentry.fastifyIntegration({\n * shouldHandleError(error, minimalRequest, minimalReply) {\n * const request = minimalRequest as FastifyRequest;\n * const reply = minimalReply as FastifyReply;\n * return reply.statusCode >= 500;\n * },\n * });\n * ```\n */\n shouldHandleError: (error: Error, request: FastifyRequest, reply: FastifyReply) => boolean;\n}\n\ninterface FastifyHandlerOptions {\n /**\n * Callback method deciding whether error should be captured and sent to Sentry\n *\n * @param error Captured Fastify error\n * @param request Fastify request (or any object containing at least method, routeOptions.url, and routerPath)\n * @param reply Fastify reply (or any object containing at least statusCode)\n *\n * @deprecated Configure `shouldHandleError` on `fastifyIntegration()` rather than here, where it\n * applies to every supported Fastify version. This option will be removed in v11.\n *\n * @example\n *\n * ```javascript\n * Sentry.init({\n * integrations: [\n * Sentry.fastifyIntegration({\n * shouldHandleError(_error, _request, reply) {\n * return reply.statusCode >= 500;\n * },\n * }),\n * ],\n * });\n * ```\n */\n shouldHandleError: (error: Error, request: FastifyRequest, reply: FastifyReply) => boolean;\n}\n\nconst INTEGRATION_NAME = 'Fastify' as const;\n\nexport const instrumentFastifyV3 = generateInstrumentOnce(\n `${INTEGRATION_NAME}.v3`,\n () => new FastifyInstrumentationV3(),\n);\n\nfunction getFastifyIntegration(): FastifyIntegration | undefined {\n const client = getClient();\n if (!client) {\n return undefined;\n } else {\n return client.getIntegrationByName(INTEGRATION_NAME);\n }\n}\n\nconst _fastifyIntegration = ((options: Partial<FastifyIntegrationOptions>) => {\n const parentIntegration = serverUtilsFastifyIntegration(options) as FastifyIntegration;\n\n return extendIntegration(parentIntegration, {\n setupOnce() {\n instrumentFastifyV3();\n },\n });\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for [Fastify](https://fastify.dev/).\n *\n * If you also want to capture errors, you need to call `setupFastifyErrorHandler(app)` after you set up your Fastify server.\n *\n * For more information, see the [fastify documentation](https://docs.sentry.io/platforms/javascript/guides/fastify/).\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [Sentry.fastifyIntegration()],\n * })\n * ```\n */\nexport const fastifyIntegration = defineIntegration((options: Partial<FastifyIntegrationOptions> = {}) =>\n _fastifyIntegration(options),\n);\n\n/**\n * Add an Fastify error handler to capture errors to Sentry.\n *\n * @param fastify The Fastify instance to which to add the error handler\n * @param options Configuration options for the handler\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n * const Fastify = require(\"fastify\");\n *\n * const app = Fastify();\n *\n * Sentry.setupFastifyErrorHandler(app);\n *\n * // Add your routes, etc.\n *\n * app.listen({ port: 3000 });\n * ```\n */\nexport function setupFastifyErrorHandler(fastify: FastifyMinimal, options?: Partial<FastifyHandlerOptions>): void {\n // oxlint-disable-next-line typescript/no-deprecated\n if (options?.shouldHandleError) {\n // oxlint-disable-next-line typescript/no-deprecated\n getFastifyIntegration()?.setShouldHandleError(options.shouldHandleError);\n }\n\n const plugin = Object.assign(\n function (fastify: FastifyInstance, _options: unknown, done: () => void): void {\n fastify.addHook('onError', async (request, reply, error) => {\n // oxlint-disable-next-line typescript/no-deprecated\n handleFastifyError.call(handleFastifyError, error, request, reply, 'onError-hook');\n });\n done();\n },\n {\n [Symbol.for('skip-override')]: true,\n [Symbol.for('fastify.display-name')]: 'sentry-fastify-error-handler',\n },\n );\n\n fastify.register(plugin);\n}\n"],"names":["generateInstrumentOnce","FastifyInstrumentationV3","getClient","serverUtilsFastifyIntegration","extendIntegration","defineIntegration","fastify","handleFastifyError"],"mappings":";;;;;;;AAmGA,MAAM,gBAAA,GAAmB,SAAA;AAElB,MAAM,mBAAA,GAAsBA,+BAAA;AAAA,EACjC,GAAG,gBAAgB,CAAA,GAAA,CAAA;AAAA,EACnB,MAAM,IAAIC,wCAAA;AACZ;AAEA,SAAS,qBAAA,GAAwD;AAC/D,EAAA,MAAM,SAASC,cAAA,EAAU;AACzB,EAAA,IAAI,CAAC,MAAA,EAAQ;AACX,IAAA,OAAO,MAAA;AAAA,EACT,CAAA,MAAO;AACL,IAAA,OAAO,MAAA,CAAO,qBAAqB,gBAAgB,CAAA;AAAA,EACrD;AACF;AAEA,MAAM,mBAAA,IAAuB,CAAC,OAAA,KAAgD;AAC5E,EAAA,MAAM,iBAAA,GAAoBC,+BAA8B,OAAO,CAAA;AAE/D,EAAA,OAAOC,uBAAkB,iBAAA,EAAmB;AAAA,IAC1C,SAAA,GAAY;AACV,MAAA,mBAAA,EAAoB;AAAA,IACtB;AAAA,GACD,CAAA;AACH,CAAA,CAAA;AAkBO,MAAM,kBAAA,GAAqBC,sBAAA;AAAA,EAAkB,CAAC,OAAA,GAA8C,EAAC,KAClG,oBAAoB,OAAO;AAC7B;AAsBO,SAAS,wBAAA,CAAyB,SAAyB,OAAA,EAAgD;AAEhH,EAAA,IAAI,SAAS,iBAAA,EAAmB;AAE9B,IAAA,qBAAA,EAAsB,EAAG,oBAAA,CAAqB,OAAA,CAAQ,iBAAiB,CAAA;AAAA,EACzE;AAEA,EAAA,MAAM,SAAS,MAAA,CAAO,MAAA;AAAA,IACpB,SAAUC,QAAAA,EAA0B,QAAA,EAAmB,IAAA,EAAwB;AAC7E,MAAAA,SAAQ,OAAA,CAAQ,SAAA,EAAW,OAAO,OAAA,EAAS,OAAO,KAAA,KAAU;AAE1D,QAAAC,8BAAA,CAAmB,IAAA,CAAKA,8BAAA,EAAoB,KAAA,EAAO,OAAA,EAAS,OAAO,cAAc,CAAA;AAAA,MACnF,CAAC,CAAA;AACD,MAAA,IAAA,EAAK;AAAA,IACP,CAAA;AAAA,IACA;AAAA,MACE,iBAAC,MAAA,CAAO,GAAA,CAAI,eAAe,CAAC,GAAG,IAAA;AAAA,MAC/B,iBAAC,MAAA,CAAO,GAAA,CAAI,sBAAsB,CAAC,GAAG;AAAA;AACxC,GACF;AAEA,EAAA,OAAA,CAAQ,SAAS,MAAM,CAAA;AACzB;;;;;;;"}
|
|
@@ -49,6 +49,10 @@ const _expressIntegration = ((options) => {
|
|
|
49
49
|
name: INTEGRATION_NAME,
|
|
50
50
|
setupOnce() {
|
|
51
51
|
instrumentExpress(options);
|
|
52
|
+
},
|
|
53
|
+
// Read back by `expressErrorHandler` in `@sentry/core`, which is what captures Express errors.
|
|
54
|
+
getShouldHandleError() {
|
|
55
|
+
return options?.shouldHandleError;
|
|
52
56
|
}
|
|
53
57
|
};
|
|
54
58
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"express.js","sources":["../../../../src/integrations/tracing/express.ts"],"sourcesContent":["// Automatic istrumentation for Express using OTel\nimport type { InstrumentationConfig } from '@opentelemetry/instrumentation';\nimport { InstrumentationBase, InstrumentationNodeModuleDefinition } from '@opentelemetry/instrumentation';\n\nimport { ensureIsWrapped, generateInstrumentOnce } from '@sentry/node-core';\nimport {\n type ExpressIntegrationOptions,\n type IntegrationFn,\n debug,\n patchExpressModule,\n SDK_VERSION,\n defineIntegration,\n setupExpressErrorHandler as coreSetupExpressErrorHandler,\n type ExpressHandlerOptions,\n} from '@sentry/core';\nexport { expressErrorHandler } from '@sentry/core';\nimport { DEBUG_BUILD } from '../../debug-build';\nimport { setHttpServerSpanRouteAttribute } from '../../utils/setHttpServerSpanRouteAttribute';\n\nconst INTEGRATION_NAME = 'Express' as const;\nconst SUPPORTED_VERSIONS = ['>=4.0.0 <6'];\n\nexport function setupExpressErrorHandler(\n //oxlint-disable-next-line no-explicit-any\n app: { use: (middleware: any) => unknown },\n options?: ExpressHandlerOptions,\n): void {\n coreSetupExpressErrorHandler(app, options);\n ensureIsWrapped(app.use, 'express');\n}\n\nexport type ExpressInstrumentationConfig = InstrumentationConfig &\n Omit<ExpressIntegrationOptions, 'express' | 'onRouteResolved'>;\n\nexport const instrumentExpress = generateInstrumentOnce(\n INTEGRATION_NAME,\n (options?: ExpressInstrumentationConfig) => new ExpressInstrumentation(options),\n);\n\nexport class ExpressInstrumentation extends InstrumentationBase<ExpressInstrumentationConfig> {\n public constructor(config: ExpressInstrumentationConfig = {}) {\n super('sentry-express', SDK_VERSION, config);\n }\n public init(): InstrumentationNodeModuleDefinition {\n const module = new InstrumentationNodeModuleDefinition(\n 'express',\n SUPPORTED_VERSIONS,\n express => {\n try {\n patchExpressModule(express, () => ({\n ...this.getConfig(),\n onRouteResolved(route) {\n if (route) {\n setHttpServerSpanRouteAttribute(route);\n }\n },\n }));\n } catch (e) {\n DEBUG_BUILD && debug.error('Failed to patch express module:', e);\n }\n return express;\n },\n // we do not ever actually unpatch in our SDKs\n express => express,\n );\n return module;\n }\n}\nconst _expressIntegration = ((options?: ExpressInstrumentationConfig) => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentExpress(options);\n },\n };\n}) satisfies IntegrationFn;\n\nexport const expressIntegration = defineIntegration(_expressIntegration);\n"],"names":["coreSetupExpressErrorHandler"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"express.js","sources":["../../../../src/integrations/tracing/express.ts"],"sourcesContent":["// Automatic istrumentation for Express using OTel\nimport type { InstrumentationConfig } from '@opentelemetry/instrumentation';\nimport { InstrumentationBase, InstrumentationNodeModuleDefinition } from '@opentelemetry/instrumentation';\n\nimport { ensureIsWrapped, generateInstrumentOnce } from '@sentry/node-core';\nimport {\n type ExpressIntegration,\n type ExpressIntegrationOptions,\n type IntegrationFn,\n debug,\n patchExpressModule,\n SDK_VERSION,\n defineIntegration,\n setupExpressErrorHandler as coreSetupExpressErrorHandler,\n type ExpressHandlerOptions,\n} from '@sentry/core';\nexport { expressErrorHandler } from '@sentry/core';\nimport { DEBUG_BUILD } from '../../debug-build';\nimport { setHttpServerSpanRouteAttribute } from '../../utils/setHttpServerSpanRouteAttribute';\n\nconst INTEGRATION_NAME = 'Express' as const;\nconst SUPPORTED_VERSIONS = ['>=4.0.0 <6'];\n\nexport function setupExpressErrorHandler(\n //oxlint-disable-next-line no-explicit-any\n app: { use: (middleware: any) => unknown },\n options?: ExpressHandlerOptions,\n): void {\n coreSetupExpressErrorHandler(app, options);\n ensureIsWrapped(app.use, 'express');\n}\n\nexport type ExpressInstrumentationConfig = InstrumentationConfig &\n Omit<ExpressIntegrationOptions, 'express' | 'onRouteResolved'>;\n\nexport const instrumentExpress = generateInstrumentOnce(\n INTEGRATION_NAME,\n (options?: ExpressInstrumentationConfig) => new ExpressInstrumentation(options),\n);\n\nexport class ExpressInstrumentation extends InstrumentationBase<ExpressInstrumentationConfig> {\n public constructor(config: ExpressInstrumentationConfig = {}) {\n super('sentry-express', SDK_VERSION, config);\n }\n public init(): InstrumentationNodeModuleDefinition {\n const module = new InstrumentationNodeModuleDefinition(\n 'express',\n SUPPORTED_VERSIONS,\n express => {\n try {\n patchExpressModule(express, () => ({\n ...this.getConfig(),\n onRouteResolved(route) {\n if (route) {\n setHttpServerSpanRouteAttribute(route);\n }\n },\n }));\n } catch (e) {\n DEBUG_BUILD && debug.error('Failed to patch express module:', e);\n }\n return express;\n },\n // we do not ever actually unpatch in our SDKs\n express => express,\n );\n return module;\n }\n}\nconst _expressIntegration = ((options?: ExpressInstrumentationConfig) => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentExpress(options);\n },\n // Read back by `expressErrorHandler` in `@sentry/core`, which is what captures Express errors.\n getShouldHandleError() {\n return options?.shouldHandleError;\n },\n } satisfies ExpressIntegration;\n}) satisfies IntegrationFn;\n\nexport const expressIntegration = defineIntegration(_expressIntegration);\n"],"names":["coreSetupExpressErrorHandler"],"mappings":";;;;;;;AAoBA,MAAM,gBAAA,GAAmB,SAAA;AACzB,MAAM,kBAAA,GAAqB,CAAC,YAAY,CAAA;AAEjC,SAAS,wBAAA,CAEd,KACA,OAAA,EACM;AACN,EAAAA,0BAAA,CAA6B,KAAK,OAAO,CAAA;AACzC,EAAA,eAAA,CAAgB,GAAA,CAAI,KAAK,SAAS,CAAA;AACpC;AAKO,MAAM,iBAAA,GAAoB,sBAAA;AAAA,EAC/B,gBAAA;AAAA,EACA,CAAC,OAAA,KAA2C,IAAI,sBAAA,CAAuB,OAAO;AAChF;AAEO,MAAM,+BAA+B,mBAAA,CAAkD;AAAA,EACrF,WAAA,CAAY,MAAA,GAAuC,EAAC,EAAG;AAC5D,IAAA,KAAA,CAAM,gBAAA,EAAkB,aAAa,MAAM,CAAA;AAAA,EAC7C;AAAA,EACO,IAAA,GAA4C;AACjD,IAAA,MAAM,SAAS,IAAI,mCAAA;AAAA,MACjB,SAAA;AAAA,MACA,kBAAA;AAAA,MACA,CAAA,OAAA,KAAW;AACT,QAAA,IAAI;AACF,UAAA,kBAAA,CAAmB,SAAS,OAAO;AAAA,YACjC,GAAG,KAAK,SAAA,EAAU;AAAA,YAClB,gBAAgB,KAAA,EAAO;AACrB,cAAA,IAAI,KAAA,EAAO;AACT,gBAAA,+BAAA,CAAgC,KAAK,CAAA;AAAA,cACvC;AAAA,YACF;AAAA,WACF,CAAE,CAAA;AAAA,QACJ,SAAS,CAAA,EAAG;AACV,UAAA,WAAA,IAAe,KAAA,CAAM,KAAA,CAAM,iCAAA,EAAmC,CAAC,CAAA;AAAA,QACjE;AACA,QAAA,OAAO,OAAA;AAAA,MACT,CAAA;AAAA;AAAA,MAEA,CAAA,OAAA,KAAW;AAAA,KACb;AACA,IAAA,OAAO,MAAA;AAAA,EACT;AACF;AACA,MAAM,mBAAA,IAAuB,CAAC,OAAA,KAA2C;AACvE,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,gBAAA;AAAA,IACN,SAAA,GAAY;AACV,MAAA,iBAAA,CAAkB,OAAO,CAAA;AAAA,IAC3B,CAAA;AAAA;AAAA,IAEA,oBAAA,GAAuB;AACrB,MAAA,OAAO,OAAA,EAAS,iBAAA;AAAA,IAClB;AAAA,GACF;AACF,CAAA,CAAA;AAEO,MAAM,kBAAA,GAAqB,kBAAkB,mBAAmB;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../src/integrations/tracing/fastify/index.ts"],"sourcesContent":["import type { Integration, IntegrationFn } from '@sentry/core';\nimport { defineIntegration, extendIntegration, getClient } from '@sentry/core';\nimport { generateInstrumentOnce } from '@sentry/node-core';\nimport type { FastifyInstance, FastifyMinimal, FastifyReply, FastifyRequest } from './types';\nimport { FastifyInstrumentationV3 } from './v3/instrumentation';\nimport {\n fastifyIntegration as serverUtilsFastifyIntegration,\n instrumentFastify,\n handleFastifyError,\n} from '@sentry/server-utils';\n\ninterface FastifyIntegration extends Integration {\n getShouldHandleError: () => (error: Error, request: FastifyRequest, reply: FastifyReply) => boolean;\n // todo(v11): Remove this\n setShouldHandleError: (\n shouldHandleError: (error: Error, request: FastifyRequest, reply: FastifyReply) => boolean,\n ) => void;\n}\n\n// oxlint-disable-next-line typescript/no-deprecated\nexport { instrumentFastify };\n\n/**\n * Options for the Fastify integration.\n *\n * `shouldHandleError` - Callback method deciding whether error should be captured and sent to Sentry\n
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../src/integrations/tracing/fastify/index.ts"],"sourcesContent":["import type { Integration, IntegrationFn } from '@sentry/core';\nimport { defineIntegration, extendIntegration, getClient } from '@sentry/core';\nimport { generateInstrumentOnce } from '@sentry/node-core';\nimport type { FastifyInstance, FastifyMinimal, FastifyReply, FastifyRequest } from './types';\nimport { FastifyInstrumentationV3 } from './v3/instrumentation';\nimport {\n fastifyIntegration as serverUtilsFastifyIntegration,\n instrumentFastify,\n handleFastifyError,\n} from '@sentry/server-utils';\n\ninterface FastifyIntegration extends Integration {\n getShouldHandleError: () => (error: Error, request: FastifyRequest, reply: FastifyReply) => boolean;\n // todo(v11): Remove this\n setShouldHandleError: (\n shouldHandleError: (error: Error, request: FastifyRequest, reply: FastifyReply) => boolean,\n ) => void;\n}\n\n// oxlint-disable-next-line typescript/no-deprecated\nexport { instrumentFastify };\n\n/**\n * Options for the Fastify integration.\n *\n * `shouldHandleError` - Callback method deciding whether error should be captured and sent to Sentry\n *\n * @example\n *\n * ```javascript\n * Sentry.init({\n * integrations: [\n * Sentry.fastifyIntegration({\n * shouldHandleError(_error, _request, reply) {\n * return reply.statusCode >= 500;\n * },\n * });\n * },\n * });\n * ```\n *\n */\ninterface FastifyIntegrationOptions {\n /**\n * Callback method deciding whether error should be captured and sent to Sentry\n * This is used on Fastify v5 where Sentry handles errors in the diagnostics channel.\n * Fastify v3 and v4 use `setupFastifyErrorHandler` instead.\n *\n * @param error Captured Fastify error\n * @param request Fastify request (or any object containing at least method, routeOptions.url, and routerPath)\n * @param reply Fastify reply (or any object containing at least statusCode)\n *\n * @example\n *\n * If using TypeScript, you can cast the request and reply to get full type safety.\n *\n * ```typescript\n * import type { FastifyRequest, FastifyReply } from 'fastify';\n *\n * Sentry.fastifyIntegration({\n * shouldHandleError(error, minimalRequest, minimalReply) {\n * const request = minimalRequest as FastifyRequest;\n * const reply = minimalReply as FastifyReply;\n * return reply.statusCode >= 500;\n * },\n * });\n * ```\n */\n shouldHandleError: (error: Error, request: FastifyRequest, reply: FastifyReply) => boolean;\n}\n\ninterface FastifyHandlerOptions {\n /**\n * Callback method deciding whether error should be captured and sent to Sentry\n *\n * @param error Captured Fastify error\n * @param request Fastify request (or any object containing at least method, routeOptions.url, and routerPath)\n * @param reply Fastify reply (or any object containing at least statusCode)\n *\n * @deprecated Configure `shouldHandleError` on `fastifyIntegration()` rather than here, where it\n * applies to every supported Fastify version. This option will be removed in v11.\n *\n * @example\n *\n * ```javascript\n * Sentry.init({\n * integrations: [\n * Sentry.fastifyIntegration({\n * shouldHandleError(_error, _request, reply) {\n * return reply.statusCode >= 500;\n * },\n * }),\n * ],\n * });\n * ```\n */\n shouldHandleError: (error: Error, request: FastifyRequest, reply: FastifyReply) => boolean;\n}\n\nconst INTEGRATION_NAME = 'Fastify' as const;\n\nexport const instrumentFastifyV3 = generateInstrumentOnce(\n `${INTEGRATION_NAME}.v3`,\n () => new FastifyInstrumentationV3(),\n);\n\nfunction getFastifyIntegration(): FastifyIntegration | undefined {\n const client = getClient();\n if (!client) {\n return undefined;\n } else {\n return client.getIntegrationByName(INTEGRATION_NAME);\n }\n}\n\nconst _fastifyIntegration = ((options: Partial<FastifyIntegrationOptions>) => {\n const parentIntegration = serverUtilsFastifyIntegration(options) as FastifyIntegration;\n\n return extendIntegration(parentIntegration, {\n setupOnce() {\n instrumentFastifyV3();\n },\n });\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for [Fastify](https://fastify.dev/).\n *\n * If you also want to capture errors, you need to call `setupFastifyErrorHandler(app)` after you set up your Fastify server.\n *\n * For more information, see the [fastify documentation](https://docs.sentry.io/platforms/javascript/guides/fastify/).\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [Sentry.fastifyIntegration()],\n * })\n * ```\n */\nexport const fastifyIntegration = defineIntegration((options: Partial<FastifyIntegrationOptions> = {}) =>\n _fastifyIntegration(options),\n);\n\n/**\n * Add an Fastify error handler to capture errors to Sentry.\n *\n * @param fastify The Fastify instance to which to add the error handler\n * @param options Configuration options for the handler\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n * const Fastify = require(\"fastify\");\n *\n * const app = Fastify();\n *\n * Sentry.setupFastifyErrorHandler(app);\n *\n * // Add your routes, etc.\n *\n * app.listen({ port: 3000 });\n * ```\n */\nexport function setupFastifyErrorHandler(fastify: FastifyMinimal, options?: Partial<FastifyHandlerOptions>): void {\n // oxlint-disable-next-line typescript/no-deprecated\n if (options?.shouldHandleError) {\n // oxlint-disable-next-line typescript/no-deprecated\n getFastifyIntegration()?.setShouldHandleError(options.shouldHandleError);\n }\n\n const plugin = Object.assign(\n function (fastify: FastifyInstance, _options: unknown, done: () => void): void {\n fastify.addHook('onError', async (request, reply, error) => {\n // oxlint-disable-next-line typescript/no-deprecated\n handleFastifyError.call(handleFastifyError, error, request, reply, 'onError-hook');\n });\n done();\n },\n {\n [Symbol.for('skip-override')]: true,\n [Symbol.for('fastify.display-name')]: 'sentry-fastify-error-handler',\n },\n );\n\n fastify.register(plugin);\n}\n"],"names":["serverUtilsFastifyIntegration","fastify"],"mappings":";;;;;;AAmGA,MAAM,gBAAA,GAAmB,SAAA;AAElB,MAAM,mBAAA,GAAsB,sBAAA;AAAA,EACjC,GAAG,gBAAgB,CAAA,GAAA,CAAA;AAAA,EACnB,MAAM,IAAI,wBAAA;AACZ;AAEA,SAAS,qBAAA,GAAwD;AAC/D,EAAA,MAAM,SAAS,SAAA,EAAU;AACzB,EAAA,IAAI,CAAC,MAAA,EAAQ;AACX,IAAA,OAAO,MAAA;AAAA,EACT,CAAA,MAAO;AACL,IAAA,OAAO,MAAA,CAAO,qBAAqB,gBAAgB,CAAA;AAAA,EACrD;AACF;AAEA,MAAM,mBAAA,IAAuB,CAAC,OAAA,KAAgD;AAC5E,EAAA,MAAM,iBAAA,GAAoBA,qBAA8B,OAAO,CAAA;AAE/D,EAAA,OAAO,kBAAkB,iBAAA,EAAmB;AAAA,IAC1C,SAAA,GAAY;AACV,MAAA,mBAAA,EAAoB;AAAA,IACtB;AAAA,GACD,CAAA;AACH,CAAA,CAAA;AAkBO,MAAM,kBAAA,GAAqB,iBAAA;AAAA,EAAkB,CAAC,OAAA,GAA8C,EAAC,KAClG,oBAAoB,OAAO;AAC7B;AAsBO,SAAS,wBAAA,CAAyB,SAAyB,OAAA,EAAgD;AAEhH,EAAA,IAAI,SAAS,iBAAA,EAAmB;AAE9B,IAAA,qBAAA,EAAsB,EAAG,oBAAA,CAAqB,OAAA,CAAQ,iBAAiB,CAAA;AAAA,EACzE;AAEA,EAAA,MAAM,SAAS,MAAA,CAAO,MAAA;AAAA,IACpB,SAAUC,QAAAA,EAA0B,QAAA,EAAmB,IAAA,EAAwB;AAC7E,MAAAA,SAAQ,OAAA,CAAQ,SAAA,EAAW,OAAO,OAAA,EAAS,OAAO,KAAA,KAAU;AAE1D,QAAA,kBAAA,CAAmB,IAAA,CAAK,kBAAA,EAAoB,KAAA,EAAO,OAAA,EAAS,OAAO,cAAc,CAAA;AAAA,MACnF,CAAC,CAAA;AACD,MAAA,IAAA,EAAK;AAAA,IACP,CAAA;AAAA,IACA;AAAA,MACE,iBAAC,MAAA,CAAO,GAAA,CAAI,eAAe,CAAC,GAAG,IAAA;AAAA,MAC/B,iBAAC,MAAA,CAAO,GAAA,CAAI,sBAAsB,CAAC,GAAG;AAAA;AACxC,GACF;AAEA,EAAA,OAAA,CAAQ,SAAS,MAAM,CAAA;AACzB;;;;"}
|
package/build/esm/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"type":"module","version":"10.
|
|
1
|
+
{"type":"module","version":"10.73.0","sideEffects":false}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"express.d.ts","sourceRoot":"","sources":["../../../../src/integrations/tracing/express.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAC5E,OAAO,EAAE,mBAAmB,EAAE,mCAAmC,EAAE,MAAM,gCAAgC,CAAC;AAG1G,OAAO,
|
|
1
|
+
{"version":3,"file":"express.d.ts","sourceRoot":"","sources":["../../../../src/integrations/tracing/express.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAC5E,OAAO,EAAE,mBAAmB,EAAE,mCAAmC,EAAE,MAAM,gCAAgC,CAAC;AAG1G,OAAO,EAEL,KAAK,yBAAyB,EAO9B,KAAK,qBAAqB,EAC3B,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAOnD,wBAAgB,wBAAwB,CAEtC,GAAG,EAAE;IAAE,GAAG,EAAE,CAAC,UAAU,EAAE,GAAG,KAAK,OAAO,CAAA;CAAE,EAC1C,OAAO,CAAC,EAAE,qBAAqB,GAC9B,IAAI,CAGN;AAED,MAAM,MAAM,4BAA4B,GAAG,qBAAqB,GAC9D,IAAI,CAAC,yBAAyB,EAAE,SAAS,GAAG,iBAAiB,CAAC,CAAC;AAEjE,eAAO,MAAM,iBAAiB;;CAG7B,CAAC;AAEF,qBAAa,sBAAuB,SAAQ,mBAAmB,CAAC,4BAA4B,CAAC;gBACxE,MAAM,GAAE,4BAAiC;IAGrD,IAAI,IAAI,mCAAmC;CAwBnD;AAcD,eAAO,MAAM,kBAAkB;;CAAyC,CAAC"}
|
|
@@ -7,8 +7,6 @@ export { instrumentFastify };
|
|
|
7
7
|
* Options for the Fastify integration.
|
|
8
8
|
*
|
|
9
9
|
* `shouldHandleError` - Callback method deciding whether error should be captured and sent to Sentry
|
|
10
|
-
* This is used on Fastify v5 where Sentry handles errors in the diagnostics channel.
|
|
11
|
-
* Fastify v3 and v4 use `setupFastifyErrorHandler` instead.
|
|
12
10
|
*
|
|
13
11
|
* @example
|
|
14
12
|
*
|
|
@@ -34,6 +32,22 @@ interface FastifyIntegrationOptions {
|
|
|
34
32
|
* @param error Captured Fastify error
|
|
35
33
|
* @param request Fastify request (or any object containing at least method, routeOptions.url, and routerPath)
|
|
36
34
|
* @param reply Fastify reply (or any object containing at least statusCode)
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
*
|
|
38
|
+
* If using TypeScript, you can cast the request and reply to get full type safety.
|
|
39
|
+
*
|
|
40
|
+
* ```typescript
|
|
41
|
+
* import type { FastifyRequest, FastifyReply } from 'fastify';
|
|
42
|
+
*
|
|
43
|
+
* Sentry.fastifyIntegration({
|
|
44
|
+
* shouldHandleError(error, minimalRequest, minimalReply) {
|
|
45
|
+
* const request = minimalRequest as FastifyRequest;
|
|
46
|
+
* const reply = minimalReply as FastifyReply;
|
|
47
|
+
* return reply.statusCode >= 500;
|
|
48
|
+
* },
|
|
49
|
+
* });
|
|
50
|
+
* ```
|
|
37
51
|
*/
|
|
38
52
|
shouldHandleError: (error: Error, request: FastifyRequest, reply: FastifyReply) => boolean;
|
|
39
53
|
}
|
|
@@ -45,29 +59,20 @@ interface FastifyHandlerOptions {
|
|
|
45
59
|
* @param request Fastify request (or any object containing at least method, routeOptions.url, and routerPath)
|
|
46
60
|
* @param reply Fastify reply (or any object containing at least statusCode)
|
|
47
61
|
*
|
|
48
|
-
* @
|
|
62
|
+
* @deprecated Configure `shouldHandleError` on `fastifyIntegration()` rather than here, where it
|
|
63
|
+
* applies to every supported Fastify version. This option will be removed in v11.
|
|
49
64
|
*
|
|
65
|
+
* @example
|
|
50
66
|
*
|
|
51
67
|
* ```javascript
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
* If using TypeScript, you can cast the request and reply to get full type safety.
|
|
61
|
-
*
|
|
62
|
-
* ```typescript
|
|
63
|
-
* import type { FastifyRequest, FastifyReply } from 'fastify';
|
|
64
|
-
*
|
|
65
|
-
* setupFastifyErrorHandler(app, {
|
|
66
|
-
* shouldHandleError(error, minimalRequest, minimalReply) {
|
|
67
|
-
* const request = minimalRequest as FastifyRequest;
|
|
68
|
-
* const reply = minimalReply as FastifyReply;
|
|
69
|
-
* return reply.statusCode >= 500;
|
|
70
|
-
* },
|
|
68
|
+
* Sentry.init({
|
|
69
|
+
* integrations: [
|
|
70
|
+
* Sentry.fastifyIntegration({
|
|
71
|
+
* shouldHandleError(_error, _request, reply) {
|
|
72
|
+
* return reply.statusCode >= 500;
|
|
73
|
+
* },
|
|
74
|
+
* }),
|
|
75
|
+
* ],
|
|
71
76
|
* });
|
|
72
77
|
* ```
|
|
73
78
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/integrations/tracing/fastify/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAiB,MAAM,cAAc,CAAC;AAG/D,OAAO,KAAK,EAAmB,cAAc,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAC7F,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAEL,iBAAiB,EAElB,MAAM,sBAAsB,CAAC;AAW9B,OAAO,EAAE,iBAAiB,EAAE,CAAC;AAE7B
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/integrations/tracing/fastify/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAiB,MAAM,cAAc,CAAC;AAG/D,OAAO,KAAK,EAAmB,cAAc,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAC7F,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAEL,iBAAiB,EAElB,MAAM,sBAAsB,CAAC;AAW9B,OAAO,EAAE,iBAAiB,EAAE,CAAC;AAE7B;;;;;;;;;;;;;;;;;;;GAmBG;AACH,UAAU,yBAAyB;IACjC;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,iBAAiB,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,YAAY,KAAK,OAAO,CAAC;CAC5F;AAED,UAAU,qBAAqB;IAC7B;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,iBAAiB,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,YAAY,KAAK,OAAO,CAAC;CAC5F;AAID,eAAO,MAAM,mBAAmB;;CAG/B,CAAC;AAqBF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,kBAAkB;;CAE9B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,cAAc,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,qBAAqB,CAAC,GAAG,IAAI,CAsBhH"}
|
|
@@ -7,8 +7,6 @@ export { instrumentFastify };
|
|
|
7
7
|
* Options for the Fastify integration.
|
|
8
8
|
*
|
|
9
9
|
* `shouldHandleError` - Callback method deciding whether error should be captured and sent to Sentry
|
|
10
|
-
* This is used on Fastify v5 where Sentry handles errors in the diagnostics channel.
|
|
11
|
-
* Fastify v3 and v4 use `setupFastifyErrorHandler` instead.
|
|
12
10
|
*
|
|
13
11
|
* @example
|
|
14
12
|
*
|
|
@@ -34,6 +32,22 @@ interface FastifyIntegrationOptions {
|
|
|
34
32
|
* @param error Captured Fastify error
|
|
35
33
|
* @param request Fastify request (or any object containing at least method, routeOptions.url, and routerPath)
|
|
36
34
|
* @param reply Fastify reply (or any object containing at least statusCode)
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
*
|
|
38
|
+
* If using TypeScript, you can cast the request and reply to get full type safety.
|
|
39
|
+
*
|
|
40
|
+
* ```typescript
|
|
41
|
+
* import type { FastifyRequest, FastifyReply } from 'fastify';
|
|
42
|
+
*
|
|
43
|
+
* Sentry.fastifyIntegration({
|
|
44
|
+
* shouldHandleError(error, minimalRequest, minimalReply) {
|
|
45
|
+
* const request = minimalRequest as FastifyRequest;
|
|
46
|
+
* const reply = minimalReply as FastifyReply;
|
|
47
|
+
* return reply.statusCode >= 500;
|
|
48
|
+
* },
|
|
49
|
+
* });
|
|
50
|
+
* ```
|
|
37
51
|
*/
|
|
38
52
|
shouldHandleError: (error: Error, request: FastifyRequest, reply: FastifyReply) => boolean;
|
|
39
53
|
}
|
|
@@ -45,29 +59,20 @@ interface FastifyHandlerOptions {
|
|
|
45
59
|
* @param request Fastify request (or any object containing at least method, routeOptions.url, and routerPath)
|
|
46
60
|
* @param reply Fastify reply (or any object containing at least statusCode)
|
|
47
61
|
*
|
|
48
|
-
* @
|
|
62
|
+
* @deprecated Configure `shouldHandleError` on `fastifyIntegration()` rather than here, where it
|
|
63
|
+
* applies to every supported Fastify version. This option will be removed in v11.
|
|
49
64
|
*
|
|
65
|
+
* @example
|
|
50
66
|
*
|
|
51
67
|
* ```javascript
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
* If using TypeScript, you can cast the request and reply to get full type safety.
|
|
61
|
-
*
|
|
62
|
-
* ```typescript
|
|
63
|
-
* import type { FastifyRequest, FastifyReply } from 'fastify';
|
|
64
|
-
*
|
|
65
|
-
* setupFastifyErrorHandler(app, {
|
|
66
|
-
* shouldHandleError(error, minimalRequest, minimalReply) {
|
|
67
|
-
* const request = minimalRequest as FastifyRequest;
|
|
68
|
-
* const reply = minimalReply as FastifyReply;
|
|
69
|
-
* return reply.statusCode >= 500;
|
|
70
|
-
* },
|
|
68
|
+
* Sentry.init({
|
|
69
|
+
* integrations: [
|
|
70
|
+
* Sentry.fastifyIntegration({
|
|
71
|
+
* shouldHandleError(_error, _request, reply) {
|
|
72
|
+
* return reply.statusCode >= 500;
|
|
73
|
+
* },
|
|
74
|
+
* }),
|
|
75
|
+
* ],
|
|
71
76
|
* });
|
|
72
77
|
* ```
|
|
73
78
|
*/
|
package/changes.json
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
"bumped": {
|
|
3
3
|
"@opentelemetry/instrumentation": {
|
|
4
4
|
"from": "^0.220.0",
|
|
5
|
-
"to": "^0.
|
|
5
|
+
"to": "^0.222.0"
|
|
6
6
|
},
|
|
7
7
|
"@opentelemetry/sdk-trace-base": {
|
|
8
8
|
"from": "^2.9.0",
|
|
9
|
-
"to": "^2.
|
|
9
|
+
"to": "^2.11.0"
|
|
10
10
|
},
|
|
11
11
|
"@sentry/conventions": {
|
|
12
12
|
"from": "^0.16.0",
|
|
@@ -17,6 +17,6 @@
|
|
|
17
17
|
"to": "^3.4.0"
|
|
18
18
|
}
|
|
19
19
|
},
|
|
20
|
-
"timestamp": "2026-
|
|
20
|
+
"timestamp": "2026-09-01T00:39:30.839Z",
|
|
21
21
|
"totalUpdated": 4
|
|
22
22
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@depup/sentry__node",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.73.0-depup.0",
|
|
4
4
|
"description": "Sentry Node SDK using OpenTelemetry for performance instrumentation (with updated dependencies)",
|
|
5
5
|
"repository": "git://github.com/getsentry/sentry-javascript.git",
|
|
6
6
|
"homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/node",
|
|
@@ -65,13 +65,13 @@
|
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
67
|
"@opentelemetry/api": "^1.9.1",
|
|
68
|
-
"@opentelemetry/instrumentation": "^0.
|
|
69
|
-
"@opentelemetry/sdk-trace-base": "^2.
|
|
68
|
+
"@opentelemetry/instrumentation": "^0.222.0",
|
|
69
|
+
"@opentelemetry/sdk-trace-base": "^2.11.0",
|
|
70
70
|
"@sentry/conventions": "^0.21.0",
|
|
71
|
-
"@sentry/core": "10.
|
|
72
|
-
"@sentry/node-core": "10.
|
|
73
|
-
"@sentry/opentelemetry": "10.
|
|
74
|
-
"@sentry/server-utils": "10.
|
|
71
|
+
"@sentry/core": "10.73.0",
|
|
72
|
+
"@sentry/node-core": "10.73.0",
|
|
73
|
+
"@sentry/opentelemetry": "10.73.0",
|
|
74
|
+
"@sentry/server-utils": "10.73.0",
|
|
75
75
|
"import-in-the-middle": "^3.4.0"
|
|
76
76
|
},
|
|
77
77
|
"devDependencies": {
|
|
@@ -128,11 +128,11 @@
|
|
|
128
128
|
"changes": {
|
|
129
129
|
"@opentelemetry/instrumentation": {
|
|
130
130
|
"from": "^0.220.0",
|
|
131
|
-
"to": "^0.
|
|
131
|
+
"to": "^0.222.0"
|
|
132
132
|
},
|
|
133
133
|
"@opentelemetry/sdk-trace-base": {
|
|
134
134
|
"from": "^2.9.0",
|
|
135
|
-
"to": "^2.
|
|
135
|
+
"to": "^2.11.0"
|
|
136
136
|
},
|
|
137
137
|
"@sentry/conventions": {
|
|
138
138
|
"from": "^0.16.0",
|
|
@@ -145,8 +145,8 @@
|
|
|
145
145
|
},
|
|
146
146
|
"depsUpdated": 4,
|
|
147
147
|
"originalPackage": "@sentry/node",
|
|
148
|
-
"originalVersion": "10.
|
|
149
|
-
"processedAt": "2026-
|
|
148
|
+
"originalVersion": "10.73.0",
|
|
149
|
+
"processedAt": "2026-09-01T00:39:38.459Z",
|
|
150
150
|
"smokeTest": "passed"
|
|
151
151
|
}
|
|
152
152
|
}
|