@sentry/cloudflare 10.42.0 → 10.44.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/build/cjs/index.js +3 -2
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/instrumentations/instrumentDurableObjectStorage.js +7 -2
- package/build/cjs/instrumentations/instrumentDurableObjectStorage.js.map +1 -1
- package/build/cjs/instrumentations/worker/instrumentEmail.js +80 -0
- package/build/cjs/instrumentations/worker/instrumentEmail.js.map +1 -0
- package/build/cjs/instrumentations/worker/instrumentFetch.js +36 -0
- package/build/cjs/instrumentations/worker/instrumentFetch.js.map +1 -0
- package/build/cjs/instrumentations/worker/instrumentQueue.js +85 -0
- package/build/cjs/instrumentations/worker/instrumentQueue.js.map +1 -0
- package/build/cjs/instrumentations/worker/instrumentScheduled.js +82 -0
- package/build/cjs/instrumentations/worker/instrumentScheduled.js.map +1 -0
- package/build/cjs/instrumentations/worker/instrumentTail.js +63 -0
- package/build/cjs/instrumentations/worker/instrumentTail.js.map +1 -0
- package/build/cjs/request.js +1 -1
- package/build/cjs/request.js.map +1 -1
- package/build/cjs/withSentry.js +66 -0
- package/build/cjs/withSentry.js.map +1 -0
- package/build/cjs/wrapMethodWithSentry.js +7 -3
- package/build/cjs/wrapMethodWithSentry.js.map +1 -1
- package/build/esm/index.js +2 -2
- package/build/esm/instrumentations/instrumentDurableObjectStorage.js +7 -2
- package/build/esm/instrumentations/instrumentDurableObjectStorage.js.map +1 -1
- package/build/esm/instrumentations/worker/instrumentEmail.js +78 -0
- package/build/esm/instrumentations/worker/instrumentEmail.js.map +1 -0
- package/build/esm/instrumentations/worker/instrumentFetch.js +34 -0
- package/build/esm/instrumentations/worker/instrumentFetch.js.map +1 -0
- package/build/esm/instrumentations/worker/instrumentQueue.js +83 -0
- package/build/esm/instrumentations/worker/instrumentQueue.js.map +1 -0
- package/build/esm/instrumentations/worker/instrumentScheduled.js +80 -0
- package/build/esm/instrumentations/worker/instrumentScheduled.js.map +1 -0
- package/build/esm/instrumentations/worker/instrumentTail.js +61 -0
- package/build/esm/instrumentations/worker/instrumentTail.js.map +1 -0
- package/build/esm/package.json +1 -1
- package/build/esm/request.js +1 -1
- package/build/esm/request.js.map +1 -1
- package/build/esm/withSentry.js +64 -0
- package/build/esm/withSentry.js.map +1 -0
- package/build/esm/wrapMethodWithSentry.js +7 -3
- package/build/esm/wrapMethodWithSentry.js.map +1 -1
- package/build/types/index.d.ts +2 -2
- package/build/types/index.d.ts.map +1 -1
- package/build/types/instrumentations/instrumentDurableObjectStorage.d.ts.map +1 -1
- package/build/types/instrumentations/worker/instrumentEmail.d.ts +7 -0
- package/build/types/instrumentations/worker/instrumentEmail.d.ts.map +1 -0
- package/build/types/instrumentations/worker/instrumentFetch.d.ts +7 -0
- package/build/types/instrumentations/worker/instrumentFetch.d.ts.map +1 -0
- package/build/types/instrumentations/worker/instrumentQueue.d.ts +7 -0
- package/build/types/instrumentations/worker/instrumentQueue.d.ts.map +1 -0
- package/build/types/instrumentations/worker/instrumentScheduled.d.ts +7 -0
- package/build/types/instrumentations/worker/instrumentScheduled.d.ts.map +1 -0
- package/build/types/instrumentations/worker/instrumentTail.d.ts +7 -0
- package/build/types/instrumentations/worker/instrumentTail.d.ts.map +1 -0
- package/build/types/{handler.d.ts → withSentry.d.ts} +1 -1
- package/build/types/withSentry.d.ts.map +1 -0
- package/build/types/wrapMethodWithSentry.d.ts.map +1 -1
- package/build/types-ts3.8/index.d.ts +2 -2
- package/build/types-ts3.8/instrumentations/worker/instrumentEmail.d.ts +7 -0
- package/build/types-ts3.8/instrumentations/worker/instrumentFetch.d.ts +7 -0
- package/build/types-ts3.8/instrumentations/worker/instrumentQueue.d.ts +7 -0
- package/build/types-ts3.8/instrumentations/worker/instrumentScheduled.d.ts +7 -0
- package/build/types-ts3.8/instrumentations/worker/instrumentTail.d.ts +7 -0
- package/build/types-ts3.8/{handler.d.ts → withSentry.d.ts} +1 -1
- package/package.json +4 -4
- package/build/cjs/handler.js +0 -251
- package/build/cjs/handler.js.map +0 -1
- package/build/esm/handler.js +0 -249
- package/build/esm/handler.js.map +0 -1
- package/build/types/handler.d.ts.map +0 -1
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { setAsyncLocalStorageAsyncContextStrategy } from './async.js';
|
|
2
|
+
import { isInstrumented, markAsInstrumented } from './instrument.js';
|
|
3
|
+
import { getHonoIntegration } from './integrations/hono.js';
|
|
4
|
+
import { instrumentExportedHandlerEmail } from './instrumentations/worker/instrumentEmail.js';
|
|
5
|
+
import { instrumentExportedHandlerFetch } from './instrumentations/worker/instrumentFetch.js';
|
|
6
|
+
import { instrumentExportedHandlerQueue } from './instrumentations/worker/instrumentQueue.js';
|
|
7
|
+
import { instrumentExportedHandlerScheduled } from './instrumentations/worker/instrumentScheduled.js';
|
|
8
|
+
import { instrumentExportedHandlerTail } from './instrumentations/worker/instrumentTail.js';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Wrapper for Cloudflare handlers.
|
|
12
|
+
*
|
|
13
|
+
* Initializes the SDK and wraps the handler with Sentry instrumentation.
|
|
14
|
+
*
|
|
15
|
+
* Automatically instruments the `fetch` method of the handler.
|
|
16
|
+
*
|
|
17
|
+
* @param optionsCallback Function that returns the options for the SDK initialization.
|
|
18
|
+
* @param handler {ExportedHandler} The handler to wrap.
|
|
19
|
+
* @returns The wrapped handler.
|
|
20
|
+
*/
|
|
21
|
+
function withSentry
|
|
22
|
+
|
|
23
|
+
(optionsCallback, handler) {
|
|
24
|
+
setAsyncLocalStorageAsyncContextStrategy();
|
|
25
|
+
|
|
26
|
+
try {
|
|
27
|
+
instrumentExportedHandlerFetch(handler, optionsCallback);
|
|
28
|
+
instrumentHonoErrorHandler(handler);
|
|
29
|
+
instrumentExportedHandlerScheduled(handler, optionsCallback);
|
|
30
|
+
instrumentExportedHandlerEmail(handler, optionsCallback);
|
|
31
|
+
instrumentExportedHandlerQueue(handler, optionsCallback);
|
|
32
|
+
instrumentExportedHandlerTail(handler, optionsCallback);
|
|
33
|
+
// This is here because Miniflare sometimes cannot get instrumented
|
|
34
|
+
} catch {
|
|
35
|
+
// Do not console anything here, we don't want to spam the console with errors
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return handler;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
42
|
+
function instrumentHonoErrorHandler(handler) {
|
|
43
|
+
if (
|
|
44
|
+
'onError' in handler &&
|
|
45
|
+
'errorHandler' in handler &&
|
|
46
|
+
typeof handler.errorHandler === 'function' &&
|
|
47
|
+
!isInstrumented(handler.errorHandler)
|
|
48
|
+
) {
|
|
49
|
+
handler.errorHandler = new Proxy(handler.errorHandler, {
|
|
50
|
+
apply(target, thisArg, args) {
|
|
51
|
+
const [err, context] = args;
|
|
52
|
+
|
|
53
|
+
getHonoIntegration()?.handleHonoException(err, context);
|
|
54
|
+
|
|
55
|
+
return Reflect.apply(target, thisArg, args);
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
markAsInstrumented(handler.errorHandler);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export { withSentry };
|
|
64
|
+
//# sourceMappingURL=withSentry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withSentry.js","sources":["../../src/withSentry.ts"],"sourcesContent":["import { setAsyncLocalStorageAsyncContextStrategy } from './async';\nimport type { CloudflareOptions } from './client';\nimport { isInstrumented, markAsInstrumented } from './instrument';\nimport { getHonoIntegration } from './integrations/hono';\nimport { instrumentExportedHandlerEmail } from './instrumentations/worker/instrumentEmail';\nimport { instrumentExportedHandlerFetch } from './instrumentations/worker/instrumentFetch';\nimport { instrumentExportedHandlerQueue } from './instrumentations/worker/instrumentQueue';\nimport { instrumentExportedHandlerScheduled } from './instrumentations/worker/instrumentScheduled';\nimport { instrumentExportedHandlerTail } from './instrumentations/worker/instrumentTail';\n\n/**\n * Wrapper for Cloudflare handlers.\n *\n * Initializes the SDK and wraps the handler with Sentry instrumentation.\n *\n * Automatically instruments the `fetch` method of the handler.\n *\n * @param optionsCallback Function that returns the options for the SDK initialization.\n * @param handler {ExportedHandler} The handler to wrap.\n * @returns The wrapped handler.\n */\nexport function withSentry<\n Env = unknown,\n QueueHandlerMessage = unknown,\n CfHostMetadata = unknown,\n T extends ExportedHandler<Env, QueueHandlerMessage, CfHostMetadata> = ExportedHandler<\n Env,\n QueueHandlerMessage,\n CfHostMetadata\n >,\n>(optionsCallback: (env: Env) => CloudflareOptions | undefined, handler: T): T {\n setAsyncLocalStorageAsyncContextStrategy();\n\n try {\n instrumentExportedHandlerFetch(handler, optionsCallback);\n instrumentHonoErrorHandler(handler);\n instrumentExportedHandlerScheduled(handler, optionsCallback);\n instrumentExportedHandlerEmail(handler, optionsCallback);\n instrumentExportedHandlerQueue(handler, optionsCallback);\n instrumentExportedHandlerTail(handler, optionsCallback);\n // This is here because Miniflare sometimes cannot get instrumented\n } catch {\n // Do not console anything here, we don't want to spam the console with errors\n }\n\n return handler;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction instrumentHonoErrorHandler<T extends ExportedHandler<any, any, any>>(handler: T): void {\n if (\n 'onError' in handler &&\n 'errorHandler' in handler &&\n typeof handler.errorHandler === 'function' &&\n !isInstrumented(handler.errorHandler)\n ) {\n handler.errorHandler = new Proxy(handler.errorHandler, {\n apply(target, thisArg, args) {\n const [err, context] = args;\n\n getHonoIntegration()?.handleHonoException(err, context);\n\n return Reflect.apply(target, thisArg, args);\n },\n });\n\n markAsInstrumented(handler.errorHandler);\n }\n}\n"],"names":[],"mappings":";;;;;;;;;AAUA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS;;AAShB,CAAE,eAAe,EAA+C,OAAO,EAAQ;AAC/E,EAAE,wCAAwC,EAAE;;AAE5C,EAAE,IAAI;AACN,IAAI,8BAA8B,CAAC,OAAO,EAAE,eAAe,CAAC;AAC5D,IAAI,0BAA0B,CAAC,OAAO,CAAC;AACvC,IAAI,kCAAkC,CAAC,OAAO,EAAE,eAAe,CAAC;AAChE,IAAI,8BAA8B,CAAC,OAAO,EAAE,eAAe,CAAC;AAC5D,IAAI,8BAA8B,CAAC,OAAO,EAAE,eAAe,CAAC;AAC5D,IAAI,6BAA6B,CAAC,OAAO,EAAE,eAAe,CAAC;AAC3D;AACA,EAAE,EAAE,MAAM;AACV;AACA,EAAE;;AAEF,EAAE,OAAO,OAAO;AAChB;;AAEA;AACA,SAAS,0BAA0B,CAA2C,OAAO,EAAW;AAChG,EAAE;AACF,IAAI,SAAA,IAAa,OAAA;AACjB,IAAI,cAAA,IAAkB,OAAA;AACtB,IAAI,OAAO,OAAO,CAAC,YAAA,KAAiB,UAAA;AACpC,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,YAAY;AACxC,IAAI;AACJ,IAAI,OAAO,CAAC,YAAA,GAAe,IAAI,KAAK,CAAC,OAAO,CAAC,YAAY,EAAE;AAC3D,MAAM,KAAK,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE;AACnC,QAAQ,MAAM,CAAC,GAAG,EAAE,OAAO,CAAA,GAAI,IAAI;;AAEnC,QAAQ,kBAAkB,EAAE,EAAE,mBAAmB,CAAC,GAAG,EAAE,OAAO,CAAC;;AAE/D,QAAQ,OAAO,OAAO,CAAC,KAAK,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC;AACnD,MAAM,CAAC;AACP,KAAK,CAAC;;AAEN,IAAI,kBAAkB,CAAC,OAAO,CAAC,YAAY,CAAC;AAC5C,EAAE;AACF;;;;"}
|
|
@@ -42,13 +42,17 @@ function wrapMethodWithSentry(
|
|
|
42
42
|
|
|
43
43
|
const waitUntil = context?.waitUntil?.bind?.(context);
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
if (
|
|
45
|
+
let currentClient = scope.getClient();
|
|
46
|
+
// Check if client exists AND is still usable (transport not disposed)
|
|
47
|
+
// This handles the case where a previous handler disposed the client
|
|
48
|
+
// but the scope still holds a reference to it (e.g., alarm handlers in Durable Objects)
|
|
49
|
+
if (!currentClient?.getTransport()) {
|
|
47
50
|
const client = init({ ...wrapperOptions.options, ctx: context });
|
|
48
51
|
scope.setClient(client);
|
|
52
|
+
currentClient = client;
|
|
49
53
|
}
|
|
50
54
|
|
|
51
|
-
const clientToDispose = currentClient
|
|
55
|
+
const clientToDispose = currentClient;
|
|
52
56
|
|
|
53
57
|
if (!wrapperOptions.spanName) {
|
|
54
58
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wrapMethodWithSentry.js","sources":["../../src/wrapMethodWithSentry.ts"],"sourcesContent":["import type { DurableObjectStorage } from '@cloudflare/workers-types';\nimport {\n captureException,\n getClient,\n isThenable,\n type Scope,\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n startSpan,\n withIsolationScope,\n withScope,\n} from '@sentry/core';\nimport type { CloudflareOptions } from './client';\nimport { flushAndDispose } from './flush';\nimport { isInstrumented, markAsInstrumented } from './instrument';\nimport { init } from './sdk';\n\n/** Extended DurableObjectState with originalStorage exposed by instrumentContext */\ninterface InstrumentedDurableObjectState extends DurableObjectState {\n originalStorage?: DurableObjectStorage;\n}\n\ntype MethodWrapperOptions = {\n spanName?: string;\n spanOp?: string;\n options: CloudflareOptions;\n context: ExecutionContext | DurableObjectState;\n};\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type UncheckedMethod = (...args: any[]) => any;\ntype OriginalMethod = UncheckedMethod;\n\n/**\n * Wraps a method with Sentry tracing.\n *\n * @param wrapperOptions - The options for the wrapper.\n * @param handler - The method to wrap.\n * @param callback - The callback to call.\n * @param noMark - Whether to mark the method as instrumented.\n * @returns The wrapped method.\n */\nexport function wrapMethodWithSentry<T extends OriginalMethod>(\n wrapperOptions: MethodWrapperOptions,\n handler: T,\n callback?: (...args: Parameters<T>) => void,\n noMark?: true,\n): T {\n if (isInstrumented(handler)) {\n return handler;\n }\n\n if (!noMark) {\n markAsInstrumented(handler);\n }\n\n return new Proxy(handler, {\n apply(target, thisArg, args: Parameters<T>) {\n const currentClient = getClient();\n // if a client is already set, use withScope, otherwise use withIsolationScope\n const sentryWithScope = currentClient ? withScope : withIsolationScope;\n\n const wrappedFunction = (scope: Scope): unknown => {\n // In certain situations, the passed context can become undefined.\n // For example, for Astro while prerendering pages at build time.\n // see: https://github.com/getsentry/sentry-javascript/issues/13217\n const context = wrapperOptions.context as InstrumentedDurableObjectState | undefined;\n\n const waitUntil = context?.waitUntil?.bind?.(context);\n\n
|
|
1
|
+
{"version":3,"file":"wrapMethodWithSentry.js","sources":["../../src/wrapMethodWithSentry.ts"],"sourcesContent":["import type { DurableObjectStorage } from '@cloudflare/workers-types';\nimport {\n captureException,\n getClient,\n isThenable,\n type Scope,\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n startSpan,\n withIsolationScope,\n withScope,\n} from '@sentry/core';\nimport type { CloudflareOptions } from './client';\nimport { flushAndDispose } from './flush';\nimport { isInstrumented, markAsInstrumented } from './instrument';\nimport { init } from './sdk';\n\n/** Extended DurableObjectState with originalStorage exposed by instrumentContext */\ninterface InstrumentedDurableObjectState extends DurableObjectState {\n originalStorage?: DurableObjectStorage;\n}\n\ntype MethodWrapperOptions = {\n spanName?: string;\n spanOp?: string;\n options: CloudflareOptions;\n context: ExecutionContext | DurableObjectState;\n};\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type UncheckedMethod = (...args: any[]) => any;\ntype OriginalMethod = UncheckedMethod;\n\n/**\n * Wraps a method with Sentry tracing.\n *\n * @param wrapperOptions - The options for the wrapper.\n * @param handler - The method to wrap.\n * @param callback - The callback to call.\n * @param noMark - Whether to mark the method as instrumented.\n * @returns The wrapped method.\n */\nexport function wrapMethodWithSentry<T extends OriginalMethod>(\n wrapperOptions: MethodWrapperOptions,\n handler: T,\n callback?: (...args: Parameters<T>) => void,\n noMark?: true,\n): T {\n if (isInstrumented(handler)) {\n return handler;\n }\n\n if (!noMark) {\n markAsInstrumented(handler);\n }\n\n return new Proxy(handler, {\n apply(target, thisArg, args: Parameters<T>) {\n const currentClient = getClient();\n // if a client is already set, use withScope, otherwise use withIsolationScope\n const sentryWithScope = currentClient ? withScope : withIsolationScope;\n\n const wrappedFunction = (scope: Scope): unknown => {\n // In certain situations, the passed context can become undefined.\n // For example, for Astro while prerendering pages at build time.\n // see: https://github.com/getsentry/sentry-javascript/issues/13217\n const context = wrapperOptions.context as InstrumentedDurableObjectState | undefined;\n\n const waitUntil = context?.waitUntil?.bind?.(context);\n\n let currentClient = scope.getClient();\n // Check if client exists AND is still usable (transport not disposed)\n // This handles the case where a previous handler disposed the client\n // but the scope still holds a reference to it (e.g., alarm handlers in Durable Objects)\n if (!currentClient?.getTransport()) {\n const client = init({ ...wrapperOptions.options, ctx: context as unknown as ExecutionContext | undefined });\n scope.setClient(client);\n currentClient = client;\n }\n\n const clientToDispose = currentClient;\n\n if (!wrapperOptions.spanName) {\n try {\n if (callback) {\n callback(...args);\n }\n const result = Reflect.apply(target, thisArg, args);\n\n if (isThenable(result)) {\n return result.then(\n (res: unknown) => {\n waitUntil?.(flushAndDispose(clientToDispose));\n return res;\n },\n (e: unknown) => {\n captureException(e, {\n mechanism: {\n type: 'auto.faas.cloudflare.durable_object',\n handled: false,\n },\n });\n waitUntil?.(flushAndDispose(clientToDispose));\n throw e;\n },\n );\n } else {\n waitUntil?.(flushAndDispose(clientToDispose));\n return result;\n }\n } catch (e) {\n captureException(e, {\n mechanism: {\n type: 'auto.faas.cloudflare.durable_object',\n handled: false,\n },\n });\n waitUntil?.(flushAndDispose(clientToDispose));\n throw e;\n }\n }\n\n const attributes = wrapperOptions.spanOp\n ? {\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: wrapperOptions.spanOp,\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.faas.cloudflare.durable_object',\n }\n : {};\n\n return startSpan({ name: wrapperOptions.spanName, attributes }, () => {\n try {\n const result = Reflect.apply(target, thisArg, args);\n\n if (isThenable(result)) {\n return result.then(\n (res: unknown) => {\n waitUntil?.(flushAndDispose(clientToDispose));\n return res;\n },\n (e: unknown) => {\n captureException(e, {\n mechanism: {\n type: 'auto.faas.cloudflare.durable_object',\n handled: false,\n },\n });\n waitUntil?.(flushAndDispose(clientToDispose));\n throw e;\n },\n );\n } else {\n waitUntil?.(flushAndDispose(clientToDispose));\n return result;\n }\n } catch (e) {\n captureException(e, {\n mechanism: {\n type: 'auto.faas.cloudflare.durable_object',\n handled: false,\n },\n });\n waitUntil?.(flushAndDispose(clientToDispose));\n throw e;\n }\n });\n };\n\n return sentryWithScope(wrappedFunction);\n },\n });\n}\n"],"names":[],"mappings":"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"}
|
package/build/types/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export type { Breadcrumb, BreadcrumbHint, PolymorphicRequest, RequestEventData, SdkInfo, Event, EventHint, ErrorEvent, Exception, FeatureFlagsIntegration, Session, SeverityLevel, Span, StackFrame, Stacktrace, Thread, User, Metric, ExclusiveEventHintOrCaptureContext, CaptureContext, } from '@sentry/core';
|
|
2
2
|
export type { CloudflareOptions } from './client';
|
|
3
|
-
export { addEventProcessor, addBreadcrumb, addIntegration, captureException, captureEvent, captureMessage, captureFeedback, close, createTransport, lastEventId, flush, getClient, isInitialized, isEnabled, getCurrentScope, getGlobalScope, getIsolationScope, setCurrentClient, Scope, SDK_VERSION, setContext, setExtra, setExtras, setTag, setTags, setUser, getSpanStatusFromHttpCode, setHttpStatus, withScope, withIsolationScope, captureCheckIn, withMonitor, setMeasurement, getActiveSpan, getRootSpan, getTraceData, getTraceMetaTags, startSpan, startInactiveSpan, startSpanManual, startNewTrace, suppressTracing, withActiveSpan, getSpanDescendants, continueTrace, functionToStringIntegration, inboundFiltersIntegration, instrumentOpenAiClient, instrumentGoogleGenAIClient, instrumentAnthropicAiClient, eventFiltersIntegration, linkedErrorsIntegration, requestDataIntegration, extraErrorDataIntegration, dedupeIntegration, rewriteFramesIntegration, captureConsoleIntegration, moduleMetadataIntegration, supabaseIntegration, instrumentSupabaseClient, instrumentPostgresJsSql, zodErrorsIntegration, consoleIntegration, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, trpcMiddleware, spanToJSON, spanToTraceHeader, spanToBaggageHeader, updateSpanName, wrapMcpServerWithSentry, consoleLoggingIntegration, createConsolaReporter, createLangChainCallbackHandler, featureFlagsIntegration, growthbookIntegration, logger, metrics, instrumentLangGraph, } from '@sentry/core';
|
|
4
|
-
export { withSentry } from './
|
|
3
|
+
export { addEventProcessor, addBreadcrumb, addIntegration, captureException, captureEvent, captureMessage, captureFeedback, close, createTransport, lastEventId, flush, getClient, isInitialized, isEnabled, getCurrentScope, getGlobalScope, getIsolationScope, setCurrentClient, Scope, SDK_VERSION, setContext, setExtra, setExtras, setTag, setTags, setUser, setConversationId, getSpanStatusFromHttpCode, setHttpStatus, withScope, withIsolationScope, captureCheckIn, withMonitor, setMeasurement, getActiveSpan, getRootSpan, getTraceData, getTraceMetaTags, startSpan, startInactiveSpan, startSpanManual, startNewTrace, suppressTracing, withActiveSpan, getSpanDescendants, continueTrace, functionToStringIntegration, inboundFiltersIntegration, instrumentOpenAiClient, instrumentGoogleGenAIClient, instrumentAnthropicAiClient, eventFiltersIntegration, linkedErrorsIntegration, requestDataIntegration, extraErrorDataIntegration, dedupeIntegration, rewriteFramesIntegration, captureConsoleIntegration, moduleMetadataIntegration, supabaseIntegration, instrumentSupabaseClient, instrumentPostgresJsSql, zodErrorsIntegration, consoleIntegration, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, trpcMiddleware, spanToJSON, spanToTraceHeader, spanToBaggageHeader, updateSpanName, wrapMcpServerWithSentry, consoleLoggingIntegration, createConsolaReporter, createLangChainCallbackHandler, featureFlagsIntegration, growthbookIntegration, logger, metrics, instrumentLangGraph, } from '@sentry/core';
|
|
4
|
+
export { withSentry } from './withSentry';
|
|
5
5
|
export { instrumentDurableObjectWithSentry } from './durableobject';
|
|
6
6
|
export { sentryPagesPlugin } from './pages-plugin';
|
|
7
7
|
export { wrapRequestHandler } from './request';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,UAAU,EACV,cAAc,EACd,kBAAkB,EAClB,gBAAgB,EAChB,OAAO,EACP,KAAK,EACL,SAAS,EACT,UAAU,EACV,SAAS,EACT,uBAAuB,EACvB,OAAO,EACP,aAAa,EACb,IAAI,EACJ,UAAU,EACV,UAAU,EACV,MAAM,EACN,IAAI,EACJ,MAAM,EACN,kCAAkC,EAClC,cAAc,GACf,MAAM,cAAc,CAAC;AAEtB,YAAY,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAElD,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,eAAe,EACf,KAAK,EACL,eAAe,EACf,WAAW,EACX,KAAK,EACL,SAAS,EACT,aAAa,EACb,SAAS,EACT,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,KAAK,EACL,WAAW,EACX,UAAU,EACV,QAAQ,EACR,SAAS,EACT,MAAM,EACN,OAAO,EACP,OAAO,EACP,yBAAyB,EACzB,aAAa,EACb,SAAS,EACT,kBAAkB,EAClB,cAAc,EACd,WAAW,EACX,cAAc,EACd,aAAa,EACb,WAAW,EACX,YAAY,EACZ,gBAAgB,EAChB,SAAS,EACT,iBAAiB,EACjB,eAAe,EACf,aAAa,EACb,eAAe,EACf,cAAc,EACd,kBAAkB,EAClB,aAAa,EACb,2BAA2B,EAE3B,yBAAyB,EACzB,sBAAsB,EACtB,2BAA2B,EAC3B,2BAA2B,EAC3B,uBAAuB,EACvB,uBAAuB,EACvB,sBAAsB,EACtB,yBAAyB,EACzB,iBAAiB,EACjB,wBAAwB,EACxB,yBAAyB,EACzB,yBAAyB,EACzB,mBAAmB,EACnB,wBAAwB,EACxB,uBAAuB,EACvB,oBAAoB,EACpB,kBAAkB,EAClB,4BAA4B,EAC5B,gCAAgC,EAChC,gCAAgC,EAChC,qCAAqC,EACrC,cAAc,EACd,UAAU,EACV,iBAAiB,EACjB,mBAAmB,EACnB,cAAc,EACd,uBAAuB,EACvB,yBAAyB,EACzB,qBAAqB,EACrB,8BAA8B,EAC9B,uBAAuB,EACvB,qBAAqB,EACrB,MAAM,EACN,OAAO,EACP,mBAAmB,GACpB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,UAAU,EACV,cAAc,EACd,kBAAkB,EAClB,gBAAgB,EAChB,OAAO,EACP,KAAK,EACL,SAAS,EACT,UAAU,EACV,SAAS,EACT,uBAAuB,EACvB,OAAO,EACP,aAAa,EACb,IAAI,EACJ,UAAU,EACV,UAAU,EACV,MAAM,EACN,IAAI,EACJ,MAAM,EACN,kCAAkC,EAClC,cAAc,GACf,MAAM,cAAc,CAAC;AAEtB,YAAY,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAElD,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,eAAe,EACf,KAAK,EACL,eAAe,EACf,WAAW,EACX,KAAK,EACL,SAAS,EACT,aAAa,EACb,SAAS,EACT,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,KAAK,EACL,WAAW,EACX,UAAU,EACV,QAAQ,EACR,SAAS,EACT,MAAM,EACN,OAAO,EACP,OAAO,EACP,iBAAiB,EACjB,yBAAyB,EACzB,aAAa,EACb,SAAS,EACT,kBAAkB,EAClB,cAAc,EACd,WAAW,EACX,cAAc,EACd,aAAa,EACb,WAAW,EACX,YAAY,EACZ,gBAAgB,EAChB,SAAS,EACT,iBAAiB,EACjB,eAAe,EACf,aAAa,EACb,eAAe,EACf,cAAc,EACd,kBAAkB,EAClB,aAAa,EACb,2BAA2B,EAE3B,yBAAyB,EACzB,sBAAsB,EACtB,2BAA2B,EAC3B,2BAA2B,EAC3B,uBAAuB,EACvB,uBAAuB,EACvB,sBAAsB,EACtB,yBAAyB,EACzB,iBAAiB,EACjB,wBAAwB,EACxB,yBAAyB,EACzB,yBAAyB,EACzB,mBAAmB,EACnB,wBAAwB,EACxB,uBAAuB,EACvB,oBAAoB,EACpB,kBAAkB,EAClB,4BAA4B,EAC5B,gCAAgC,EAChC,gCAAgC,EAChC,qCAAqC,EACrC,cAAc,EACd,UAAU,EACV,iBAAiB,EACjB,mBAAmB,EACnB,cAAc,EACd,uBAAuB,EACvB,yBAAyB,EACzB,qBAAqB,EACrB,8BAA8B,EAC9B,uBAAuB,EACvB,qBAAqB,EACrB,MAAM,EACN,OAAO,EACP,mBAAmB,GACpB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,iCAAiC,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAE/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,sBAAsB,EAAE,MAAM,OAAO,CAAC;AAE/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,MAAM,CAAC;AAE9C,OAAO,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAC;AAE3D,OAAO,EAAE,wCAAwC,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instrumentDurableObjectStorage.d.ts","sourceRoot":"","sources":["../../../src/instrumentations/instrumentDurableObjectStorage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAOtE;;;;;;;;GAQG;AACH,wBAAgB,8BAA8B,CAAC,OAAO,EAAE,oBAAoB,GAAG,oBAAoB,
|
|
1
|
+
{"version":3,"file":"instrumentDurableObjectStorage.d.ts","sourceRoot":"","sources":["../../../src/instrumentations/instrumentDurableObjectStorage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAOtE;;;;;;;;GAQG;AACH,wBAAgB,8BAA8B,CAAC,OAAO,EAAE,oBAAoB,GAAG,oBAAoB,CAsClG"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ExportedHandler } from '@cloudflare/workers-types';
|
|
2
|
+
import type { CloudflareOptions } from '../../client';
|
|
3
|
+
/**
|
|
4
|
+
* Instruments an email handler for ExportedHandler (env/ctx come from args).
|
|
5
|
+
*/
|
|
6
|
+
export declare function instrumentExportedHandlerEmail<T extends ExportedHandler<any, any, any>>(handler: T, optionsCallback: (env: Parameters<NonNullable<T['email']>>[1]) => CloudflareOptions | undefined): void;
|
|
7
|
+
//# sourceMappingURL=instrumentEmail.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instrumentEmail.d.ts","sourceRoot":"","sources":["../../../../src/instrumentations/worker/instrumentEmail.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAgB,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAQ/E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAiDtD;;GAEG;AAEH,wBAAgB,8BAA8B,CAAC,CAAC,SAAS,eAAe,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EACrF,OAAO,EAAE,CAAC,EACV,eAAe,EAAE,CAAC,GAAG,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,iBAAiB,GAAG,SAAS,GAC9F,IAAI,CAkBN"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ExportedHandler } from '@cloudflare/workers-types';
|
|
2
|
+
import type { CloudflareOptions } from '../../client';
|
|
3
|
+
/**
|
|
4
|
+
* Instruments a fetch handler for ExportedHandler (env/ctx come from args).
|
|
5
|
+
*/
|
|
6
|
+
export declare function instrumentExportedHandlerFetch<T extends ExportedHandler<any, any, any>>(handler: T, optionsCallback: (env: Parameters<NonNullable<T['fetch']>>[1]) => CloudflareOptions | undefined): void;
|
|
7
|
+
//# sourceMappingURL=instrumentFetch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instrumentFetch.d.ts","sourceRoot":"","sources":["../../../../src/instrumentations/worker/instrumentFetch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAMtD;;GAEG;AAEH,wBAAgB,8BAA8B,CAAC,CAAC,SAAS,eAAe,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EACrF,OAAO,EAAE,CAAC,EACV,eAAe,EAAE,CAAC,GAAG,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,iBAAiB,GAAG,SAAS,GAC9F,IAAI,CAkBN"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ExportedHandler } from '@cloudflare/workers-types';
|
|
2
|
+
import type { CloudflareOptions } from '../../client';
|
|
3
|
+
/**
|
|
4
|
+
* Instruments a queue handler for ExportedHandler (env/ctx come from args).
|
|
5
|
+
*/
|
|
6
|
+
export declare function instrumentExportedHandlerQueue<T extends ExportedHandler<any, any, any>>(handler: T, optionsCallback: (env: Parameters<NonNullable<T['queue']>>[1]) => CloudflareOptions | undefined): void;
|
|
7
|
+
//# sourceMappingURL=instrumentQueue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instrumentQueue.d.ts","sourceRoot":"","sources":["../../../../src/instrumentations/worker/instrumentQueue.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAgB,MAAM,2BAA2B,CAAC;AAS/E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAsDtD;;GAEG;AAEH,wBAAgB,8BAA8B,CAAC,CAAC,SAAS,eAAe,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EACrF,OAAO,EAAE,CAAC,EACV,eAAe,EAAE,CAAC,GAAG,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,iBAAiB,GAAG,SAAS,GAC9F,IAAI,CAkBN"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ExportedHandler } from '@cloudflare/workers-types';
|
|
2
|
+
import type { CloudflareOptions } from '../../client';
|
|
3
|
+
/**
|
|
4
|
+
* Instruments a scheduled handler for ExportedHandler (env/ctx come from args).
|
|
5
|
+
*/
|
|
6
|
+
export declare function instrumentExportedHandlerScheduled<T extends ExportedHandler<any, any, any>>(handler: T, optionsCallback: (env: Parameters<NonNullable<T['scheduled']>>[1]) => CloudflareOptions | undefined): void;
|
|
7
|
+
//# sourceMappingURL=instrumentScheduled.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instrumentScheduled.d.ts","sourceRoot":"","sources":["../../../../src/instrumentations/worker/instrumentScheduled.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAuB,MAAM,2BAA2B,CAAC;AAQtF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAmDtD;;GAEG;AAEH,wBAAgB,kCAAkC,CAAC,CAAC,SAAS,eAAe,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EACzF,OAAO,EAAE,CAAC,EACV,eAAe,EAAE,CAAC,GAAG,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,iBAAiB,GAAG,SAAS,GAClG,IAAI,CAkBN"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ExportedHandler } from '@cloudflare/workers-types';
|
|
2
|
+
import type { CloudflareOptions } from '../../client';
|
|
3
|
+
/**
|
|
4
|
+
* Instruments a tail handler for ExportedHandler (env/ctx come from args).
|
|
5
|
+
*/
|
|
6
|
+
export declare function instrumentExportedHandlerTail<T extends ExportedHandler<any, any, any>>(handler: T, optionsCallback: (env: Parameters<NonNullable<T['tail']>>[1]) => CloudflareOptions | undefined): void;
|
|
7
|
+
//# sourceMappingURL=instrumentTail.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instrumentTail.d.ts","sourceRoot":"","sources":["../../../../src/instrumentations/worker/instrumentTail.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAEjE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAgCtD;;GAEG;AAEH,wBAAgB,6BAA6B,CAAC,CAAC,SAAS,eAAe,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EACpF,OAAO,EAAE,CAAC,EACV,eAAe,EAAE,CAAC,GAAG,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,iBAAiB,GAAG,SAAS,GAC7F,IAAI,CAkBN"}
|
|
@@ -11,4 +11,4 @@ import type { CloudflareOptions } from './client';
|
|
|
11
11
|
* @returns The wrapped handler.
|
|
12
12
|
*/
|
|
13
13
|
export declare function withSentry<Env = unknown, QueueHandlerMessage = unknown, CfHostMetadata = unknown, T extends ExportedHandler<Env, QueueHandlerMessage, CfHostMetadata> = ExportedHandler<Env, QueueHandlerMessage, CfHostMetadata>>(optionsCallback: (env: Env) => CloudflareOptions | undefined, handler: T): T;
|
|
14
|
-
//# sourceMappingURL=
|
|
14
|
+
//# sourceMappingURL=withSentry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withSentry.d.ts","sourceRoot":"","sources":["../../src/withSentry.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AASlD;;;;;;;;;;GAUG;AACH,wBAAgB,UAAU,CACxB,GAAG,GAAG,OAAO,EACb,mBAAmB,GAAG,OAAO,EAC7B,cAAc,GAAG,OAAO,EACxB,CAAC,SAAS,eAAe,CAAC,GAAG,EAAE,mBAAmB,EAAE,cAAc,CAAC,GAAG,eAAe,CACnF,GAAG,EACH,mBAAmB,EACnB,cAAc,CACf,EACD,eAAe,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,iBAAiB,GAAG,SAAS,EAAE,OAAO,EAAE,CAAC,GAAG,CAAC,CAgB7E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wrapMethodWithSentry.d.ts","sourceRoot":"","sources":["../../src/wrapMethodWithSentry.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAUlD,KAAK,oBAAoB,GAAG;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,iBAAiB,CAAC;IAC3B,OAAO,EAAE,gBAAgB,GAAG,kBAAkB,CAAC;CAChD,CAAC;AAGF,MAAM,MAAM,eAAe,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC;AACtD,KAAK,cAAc,GAAG,eAAe,CAAC;AAEtC;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,cAAc,EAC3D,cAAc,EAAE,oBAAoB,EACpC,OAAO,EAAE,CAAC,EACV,QAAQ,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,IAAI,EAC3C,MAAM,CAAC,EAAE,IAAI,GACZ,CAAC,
|
|
1
|
+
{"version":3,"file":"wrapMethodWithSentry.d.ts","sourceRoot":"","sources":["../../src/wrapMethodWithSentry.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAUlD,KAAK,oBAAoB,GAAG;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,iBAAiB,CAAC;IAC3B,OAAO,EAAE,gBAAgB,GAAG,kBAAkB,CAAC;CAChD,CAAC;AAGF,MAAM,MAAM,eAAe,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC;AACtD,KAAK,cAAc,GAAG,eAAe,CAAC;AAEtC;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,cAAc,EAC3D,cAAc,EAAE,oBAAoB,EACpC,OAAO,EAAE,CAAC,EACV,QAAQ,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,IAAI,EAC3C,MAAM,CAAC,EAAE,IAAI,GACZ,CAAC,CA2HH"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { Breadcrumb, BreadcrumbHint, PolymorphicRequest, RequestEventData, SdkInfo, Event, EventHint, ErrorEvent, Exception, FeatureFlagsIntegration, Session, SeverityLevel, Span, StackFrame, Stacktrace, Thread, User, Metric, ExclusiveEventHintOrCaptureContext, CaptureContext, } from '@sentry/core';
|
|
2
2
|
export { CloudflareOptions } from './client';
|
|
3
|
-
export { addEventProcessor, addBreadcrumb, addIntegration, captureException, captureEvent, captureMessage, captureFeedback, close, createTransport, lastEventId, flush, getClient, isInitialized, isEnabled, getCurrentScope, getGlobalScope, getIsolationScope, setCurrentClient, Scope, SDK_VERSION, setContext, setExtra, setExtras, setTag, setTags, setUser, getSpanStatusFromHttpCode, setHttpStatus, withScope, withIsolationScope, captureCheckIn, withMonitor, setMeasurement, getActiveSpan, getRootSpan, getTraceData, getTraceMetaTags, startSpan, startInactiveSpan, startSpanManual, startNewTrace, suppressTracing, withActiveSpan, getSpanDescendants, continueTrace, functionToStringIntegration, inboundFiltersIntegration, instrumentOpenAiClient, instrumentGoogleGenAIClient, instrumentAnthropicAiClient, eventFiltersIntegration, linkedErrorsIntegration, requestDataIntegration, extraErrorDataIntegration, dedupeIntegration, rewriteFramesIntegration, captureConsoleIntegration, moduleMetadataIntegration, supabaseIntegration, instrumentSupabaseClient, instrumentPostgresJsSql, zodErrorsIntegration, consoleIntegration, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, trpcMiddleware, spanToJSON, spanToTraceHeader, spanToBaggageHeader, updateSpanName, wrapMcpServerWithSentry, consoleLoggingIntegration, createConsolaReporter, createLangChainCallbackHandler, featureFlagsIntegration, growthbookIntegration, logger, metrics, instrumentLangGraph, } from '@sentry/core';
|
|
4
|
-
export { withSentry } from './
|
|
3
|
+
export { addEventProcessor, addBreadcrumb, addIntegration, captureException, captureEvent, captureMessage, captureFeedback, close, createTransport, lastEventId, flush, getClient, isInitialized, isEnabled, getCurrentScope, getGlobalScope, getIsolationScope, setCurrentClient, Scope, SDK_VERSION, setContext, setExtra, setExtras, setTag, setTags, setUser, setConversationId, getSpanStatusFromHttpCode, setHttpStatus, withScope, withIsolationScope, captureCheckIn, withMonitor, setMeasurement, getActiveSpan, getRootSpan, getTraceData, getTraceMetaTags, startSpan, startInactiveSpan, startSpanManual, startNewTrace, suppressTracing, withActiveSpan, getSpanDescendants, continueTrace, functionToStringIntegration, inboundFiltersIntegration, instrumentOpenAiClient, instrumentGoogleGenAIClient, instrumentAnthropicAiClient, eventFiltersIntegration, linkedErrorsIntegration, requestDataIntegration, extraErrorDataIntegration, dedupeIntegration, rewriteFramesIntegration, captureConsoleIntegration, moduleMetadataIntegration, supabaseIntegration, instrumentSupabaseClient, instrumentPostgresJsSql, zodErrorsIntegration, consoleIntegration, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, trpcMiddleware, spanToJSON, spanToTraceHeader, spanToBaggageHeader, updateSpanName, wrapMcpServerWithSentry, consoleLoggingIntegration, createConsolaReporter, createLangChainCallbackHandler, featureFlagsIntegration, growthbookIntegration, logger, metrics, instrumentLangGraph, } from '@sentry/core';
|
|
4
|
+
export { withSentry } from './withSentry';
|
|
5
5
|
export { instrumentDurableObjectWithSentry } from './durableobject';
|
|
6
6
|
export { sentryPagesPlugin } from './pages-plugin';
|
|
7
7
|
export { wrapRequestHandler } from './request';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ExportedHandler } from '@cloudflare/workers-types';
|
|
2
|
+
import { CloudflareOptions } from '../../client';
|
|
3
|
+
/**
|
|
4
|
+
* Instruments an email handler for ExportedHandler (env/ctx come from args).
|
|
5
|
+
*/
|
|
6
|
+
export declare function instrumentExportedHandlerEmail<T extends ExportedHandler<any, any, any>>(handler: T, optionsCallback: (env: Parameters<NonNullable<T['email']>>[1]) => CloudflareOptions | undefined): void;
|
|
7
|
+
//# sourceMappingURL=instrumentEmail.d.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ExportedHandler } from '@cloudflare/workers-types';
|
|
2
|
+
import { CloudflareOptions } from '../../client';
|
|
3
|
+
/**
|
|
4
|
+
* Instruments a fetch handler for ExportedHandler (env/ctx come from args).
|
|
5
|
+
*/
|
|
6
|
+
export declare function instrumentExportedHandlerFetch<T extends ExportedHandler<any, any, any>>(handler: T, optionsCallback: (env: Parameters<NonNullable<T['fetch']>>[1]) => CloudflareOptions | undefined): void;
|
|
7
|
+
//# sourceMappingURL=instrumentFetch.d.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ExportedHandler } from '@cloudflare/workers-types';
|
|
2
|
+
import { CloudflareOptions } from '../../client';
|
|
3
|
+
/**
|
|
4
|
+
* Instruments a queue handler for ExportedHandler (env/ctx come from args).
|
|
5
|
+
*/
|
|
6
|
+
export declare function instrumentExportedHandlerQueue<T extends ExportedHandler<any, any, any>>(handler: T, optionsCallback: (env: Parameters<NonNullable<T['queue']>>[1]) => CloudflareOptions | undefined): void;
|
|
7
|
+
//# sourceMappingURL=instrumentQueue.d.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ExportedHandler } from '@cloudflare/workers-types';
|
|
2
|
+
import { CloudflareOptions } from '../../client';
|
|
3
|
+
/**
|
|
4
|
+
* Instruments a scheduled handler for ExportedHandler (env/ctx come from args).
|
|
5
|
+
*/
|
|
6
|
+
export declare function instrumentExportedHandlerScheduled<T extends ExportedHandler<any, any, any>>(handler: T, optionsCallback: (env: Parameters<NonNullable<T['scheduled']>>[1]) => CloudflareOptions | undefined): void;
|
|
7
|
+
//# sourceMappingURL=instrumentScheduled.d.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ExportedHandler } from '@cloudflare/workers-types';
|
|
2
|
+
import { CloudflareOptions } from '../../client';
|
|
3
|
+
/**
|
|
4
|
+
* Instruments a tail handler for ExportedHandler (env/ctx come from args).
|
|
5
|
+
*/
|
|
6
|
+
export declare function instrumentExportedHandlerTail<T extends ExportedHandler<any, any, any>>(handler: T, optionsCallback: (env: Parameters<NonNullable<T['tail']>>[1]) => CloudflareOptions | undefined): void;
|
|
7
|
+
//# sourceMappingURL=instrumentTail.d.ts.map
|
|
@@ -11,4 +11,4 @@ import { CloudflareOptions } from './client';
|
|
|
11
11
|
* @returns The wrapped handler.
|
|
12
12
|
*/
|
|
13
13
|
export declare function withSentry<Env = unknown, QueueHandlerMessage = unknown, CfHostMetadata = unknown, T extends ExportedHandler<Env, QueueHandlerMessage, CfHostMetadata> = ExportedHandler<Env, QueueHandlerMessage, CfHostMetadata>>(optionsCallback: (env: Env) => CloudflareOptions | undefined, handler: T): T;
|
|
14
|
-
//# sourceMappingURL=
|
|
14
|
+
//# sourceMappingURL=withSentry.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/cloudflare",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.44.0",
|
|
4
4
|
"description": "Official Sentry SDK for Cloudflare Workers and Pages",
|
|
5
5
|
"repository": "git://github.com/getsentry/sentry-javascript.git",
|
|
6
6
|
"homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/cloudflare",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"@opentelemetry/api": "^1.9.0",
|
|
53
|
-
"@sentry/core": "10.
|
|
53
|
+
"@sentry/core": "10.44.0"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
56
|
"@cloudflare/workers-types": "^4.x"
|
|
@@ -78,8 +78,8 @@
|
|
|
78
78
|
"build:tarball": "npm pack",
|
|
79
79
|
"circularDepCheck": "madge --circular src/index.ts",
|
|
80
80
|
"clean": "rimraf build coverage sentry-cloudflare-*.tgz",
|
|
81
|
-
"fix": "
|
|
82
|
-
"lint": "
|
|
81
|
+
"lint:fix": "OXLINT_TSGOLINT_DANGEROUSLY_SUPPRESS_PROGRAM_DIAGNOSTICS=true oxlint . --fix --type-aware",
|
|
82
|
+
"lint": "OXLINT_TSGOLINT_DANGEROUSLY_SUPPRESS_PROGRAM_DIAGNOSTICS=true oxlint . --type-aware",
|
|
83
83
|
"lint:es-compatibility": "es-check es2022 ./build/cjs/*.js && es-check es2022 ./build/esm/*.js --module",
|
|
84
84
|
"test": "yarn test:unit",
|
|
85
85
|
"test:unit": "vitest run",
|
package/build/cjs/handler.js
DELETED
|
@@ -1,251 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
|
|
3
|
-
const core = require('@sentry/core');
|
|
4
|
-
const async = require('./async.js');
|
|
5
|
-
const flush = require('./flush.js');
|
|
6
|
-
const instrument = require('./instrument.js');
|
|
7
|
-
const hono = require('./integrations/hono.js');
|
|
8
|
-
const options = require('./options.js');
|
|
9
|
-
const request = require('./request.js');
|
|
10
|
-
const scopeUtils = require('./scope-utils.js');
|
|
11
|
-
const sdk = require('./sdk.js');
|
|
12
|
-
const instrumentContext = require('./utils/instrumentContext.js');
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Wrapper for Cloudflare handlers.
|
|
16
|
-
*
|
|
17
|
-
* Initializes the SDK and wraps the handler with Sentry instrumentation.
|
|
18
|
-
*
|
|
19
|
-
* Automatically instruments the `fetch` method of the handler.
|
|
20
|
-
*
|
|
21
|
-
* @param optionsCallback Function that returns the options for the SDK initialization.
|
|
22
|
-
* @param handler {ExportedHandler} The handler to wrap.
|
|
23
|
-
* @returns The wrapped handler.
|
|
24
|
-
*/
|
|
25
|
-
// eslint-disable-next-line complexity
|
|
26
|
-
function withSentry
|
|
27
|
-
|
|
28
|
-
(optionsCallback, handler) {
|
|
29
|
-
async.setAsyncLocalStorageAsyncContextStrategy();
|
|
30
|
-
|
|
31
|
-
try {
|
|
32
|
-
if ('fetch' in handler && typeof handler.fetch === 'function' && !instrument.isInstrumented(handler.fetch)) {
|
|
33
|
-
handler.fetch = new Proxy(handler.fetch, {
|
|
34
|
-
apply(target, thisArg, args) {
|
|
35
|
-
const [request$1, env, ctx] = args;
|
|
36
|
-
const context = instrumentContext.instrumentContext(ctx);
|
|
37
|
-
args[2] = context;
|
|
38
|
-
|
|
39
|
-
const options$1 = options.getFinalOptions(optionsCallback(env), env);
|
|
40
|
-
|
|
41
|
-
return request.wrapRequestHandler({ options: options$1, request: request$1, context }, () => target.apply(thisArg, args));
|
|
42
|
-
},
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
instrument.markAsInstrumented(handler.fetch);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/* Hono does not reach the catch block of the fetch handler and captureException needs to be called in the hono errorHandler */
|
|
49
|
-
if (
|
|
50
|
-
'onError' in handler &&
|
|
51
|
-
'errorHandler' in handler &&
|
|
52
|
-
typeof handler.errorHandler === 'function' &&
|
|
53
|
-
!instrument.isInstrumented(handler.errorHandler)
|
|
54
|
-
) {
|
|
55
|
-
handler.errorHandler = new Proxy(handler.errorHandler, {
|
|
56
|
-
apply(target, thisArg, args) {
|
|
57
|
-
const [err, context] = args;
|
|
58
|
-
|
|
59
|
-
hono.getHonoIntegration()?.handleHonoException(err, context);
|
|
60
|
-
|
|
61
|
-
return Reflect.apply(target, thisArg, args);
|
|
62
|
-
},
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
instrument.markAsInstrumented(handler.errorHandler);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
if ('scheduled' in handler && typeof handler.scheduled === 'function' && !instrument.isInstrumented(handler.scheduled)) {
|
|
69
|
-
handler.scheduled = new Proxy(handler.scheduled, {
|
|
70
|
-
apply(target, thisArg, args) {
|
|
71
|
-
const [event, env, ctx] = args;
|
|
72
|
-
const context = instrumentContext.instrumentContext(ctx);
|
|
73
|
-
args[2] = context;
|
|
74
|
-
|
|
75
|
-
return core.withIsolationScope(isolationScope => {
|
|
76
|
-
const options$1 = options.getFinalOptions(optionsCallback(env), env);
|
|
77
|
-
const waitUntil = context.waitUntil.bind(context);
|
|
78
|
-
|
|
79
|
-
const client = sdk.init({ ...options$1, ctx: context });
|
|
80
|
-
isolationScope.setClient(client);
|
|
81
|
-
|
|
82
|
-
scopeUtils.addCloudResourceContext(isolationScope);
|
|
83
|
-
|
|
84
|
-
return core.startSpan(
|
|
85
|
-
{
|
|
86
|
-
op: 'faas.cron',
|
|
87
|
-
name: `Scheduled Cron ${event.cron}`,
|
|
88
|
-
attributes: {
|
|
89
|
-
'faas.cron': event.cron,
|
|
90
|
-
'faas.time': new Date(event.scheduledTime).toISOString(),
|
|
91
|
-
'faas.trigger': 'timer',
|
|
92
|
-
[core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.faas.cloudflare.scheduled',
|
|
93
|
-
[core.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'task',
|
|
94
|
-
},
|
|
95
|
-
},
|
|
96
|
-
async () => {
|
|
97
|
-
try {
|
|
98
|
-
return await (target.apply(thisArg, args) );
|
|
99
|
-
} catch (e) {
|
|
100
|
-
core.captureException(e, { mechanism: { handled: false, type: 'auto.faas.cloudflare.scheduled' } });
|
|
101
|
-
throw e;
|
|
102
|
-
} finally {
|
|
103
|
-
waitUntil(flush.flushAndDispose(client));
|
|
104
|
-
}
|
|
105
|
-
},
|
|
106
|
-
);
|
|
107
|
-
});
|
|
108
|
-
},
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
instrument.markAsInstrumented(handler.scheduled);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
if ('email' in handler && typeof handler.email === 'function' && !instrument.isInstrumented(handler.email)) {
|
|
115
|
-
handler.email = new Proxy(handler.email, {
|
|
116
|
-
apply(target, thisArg, args) {
|
|
117
|
-
const [emailMessage, env, ctx] = args;
|
|
118
|
-
const context = instrumentContext.instrumentContext(ctx);
|
|
119
|
-
args[2] = context;
|
|
120
|
-
|
|
121
|
-
return core.withIsolationScope(isolationScope => {
|
|
122
|
-
const options$1 = options.getFinalOptions(optionsCallback(env), env);
|
|
123
|
-
const waitUntil = context.waitUntil.bind(context);
|
|
124
|
-
|
|
125
|
-
const client = sdk.init({ ...options$1, ctx: context });
|
|
126
|
-
isolationScope.setClient(client);
|
|
127
|
-
|
|
128
|
-
scopeUtils.addCloudResourceContext(isolationScope);
|
|
129
|
-
|
|
130
|
-
return core.startSpan(
|
|
131
|
-
{
|
|
132
|
-
op: 'faas.email',
|
|
133
|
-
name: `Handle Email ${emailMessage.to}`,
|
|
134
|
-
attributes: {
|
|
135
|
-
'faas.trigger': 'email',
|
|
136
|
-
[core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.faas.cloudflare.email',
|
|
137
|
-
[core.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'task',
|
|
138
|
-
},
|
|
139
|
-
},
|
|
140
|
-
async () => {
|
|
141
|
-
try {
|
|
142
|
-
return await (target.apply(thisArg, args) );
|
|
143
|
-
} catch (e) {
|
|
144
|
-
core.captureException(e, { mechanism: { handled: false, type: 'auto.faas.cloudflare.email' } });
|
|
145
|
-
throw e;
|
|
146
|
-
} finally {
|
|
147
|
-
waitUntil(flush.flushAndDispose(client));
|
|
148
|
-
}
|
|
149
|
-
},
|
|
150
|
-
);
|
|
151
|
-
});
|
|
152
|
-
},
|
|
153
|
-
});
|
|
154
|
-
|
|
155
|
-
instrument.markAsInstrumented(handler.email);
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
if ('queue' in handler && typeof handler.queue === 'function' && !instrument.isInstrumented(handler.queue)) {
|
|
159
|
-
handler.queue = new Proxy(handler.queue, {
|
|
160
|
-
apply(target, thisArg, args) {
|
|
161
|
-
const [batch, env, ctx] = args;
|
|
162
|
-
const context = instrumentContext.instrumentContext(ctx);
|
|
163
|
-
args[2] = context;
|
|
164
|
-
|
|
165
|
-
return core.withIsolationScope(isolationScope => {
|
|
166
|
-
const options$1 = options.getFinalOptions(optionsCallback(env), env);
|
|
167
|
-
const waitUntil = context.waitUntil.bind(context);
|
|
168
|
-
|
|
169
|
-
const client = sdk.init({ ...options$1, ctx: context });
|
|
170
|
-
isolationScope.setClient(client);
|
|
171
|
-
|
|
172
|
-
scopeUtils.addCloudResourceContext(isolationScope);
|
|
173
|
-
|
|
174
|
-
return core.startSpan(
|
|
175
|
-
{
|
|
176
|
-
op: 'faas.queue',
|
|
177
|
-
name: `process ${batch.queue}`,
|
|
178
|
-
attributes: {
|
|
179
|
-
'faas.trigger': 'pubsub',
|
|
180
|
-
'messaging.destination.name': batch.queue,
|
|
181
|
-
'messaging.system': 'cloudflare',
|
|
182
|
-
'messaging.batch.message_count': batch.messages.length,
|
|
183
|
-
'messaging.message.retry.count': batch.messages.reduce(
|
|
184
|
-
(acc, message) => acc + message.attempts - 1,
|
|
185
|
-
0,
|
|
186
|
-
),
|
|
187
|
-
[core.SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'queue.process',
|
|
188
|
-
[core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.faas.cloudflare.queue',
|
|
189
|
-
[core.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'task',
|
|
190
|
-
},
|
|
191
|
-
},
|
|
192
|
-
async () => {
|
|
193
|
-
try {
|
|
194
|
-
return await (target.apply(thisArg, args) );
|
|
195
|
-
} catch (e) {
|
|
196
|
-
core.captureException(e, { mechanism: { handled: false, type: 'auto.faas.cloudflare.queue' } });
|
|
197
|
-
throw e;
|
|
198
|
-
} finally {
|
|
199
|
-
waitUntil(flush.flushAndDispose(client));
|
|
200
|
-
}
|
|
201
|
-
},
|
|
202
|
-
);
|
|
203
|
-
});
|
|
204
|
-
},
|
|
205
|
-
});
|
|
206
|
-
|
|
207
|
-
instrument.markAsInstrumented(handler.queue);
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
if ('tail' in handler && typeof handler.tail === 'function' && !instrument.isInstrumented(handler.tail)) {
|
|
211
|
-
handler.tail = new Proxy(handler.tail, {
|
|
212
|
-
apply(target, thisArg, args) {
|
|
213
|
-
const [, env, ctx] = args;
|
|
214
|
-
const context = instrumentContext.instrumentContext(ctx);
|
|
215
|
-
args[2] = context;
|
|
216
|
-
|
|
217
|
-
return core.withIsolationScope(async isolationScope => {
|
|
218
|
-
const options$1 = options.getFinalOptions(optionsCallback(env), env);
|
|
219
|
-
|
|
220
|
-
const waitUntil = context.waitUntil.bind(context);
|
|
221
|
-
|
|
222
|
-
const client = sdk.init({ ...options$1, ctx: context });
|
|
223
|
-
isolationScope.setClient(client);
|
|
224
|
-
|
|
225
|
-
scopeUtils.addCloudResourceContext(isolationScope);
|
|
226
|
-
|
|
227
|
-
try {
|
|
228
|
-
return await (target.apply(thisArg, args) );
|
|
229
|
-
} catch (e) {
|
|
230
|
-
core.captureException(e, { mechanism: { handled: false, type: 'auto.faas.cloudflare.tail' } });
|
|
231
|
-
throw e;
|
|
232
|
-
} finally {
|
|
233
|
-
waitUntil(flush.flushAndDispose(client));
|
|
234
|
-
}
|
|
235
|
-
});
|
|
236
|
-
},
|
|
237
|
-
});
|
|
238
|
-
|
|
239
|
-
instrument.markAsInstrumented(handler.tail);
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
// This is here because Miniflare sometimes cannot get instrumented
|
|
243
|
-
} catch {
|
|
244
|
-
// Do not console anything here, we don't want to spam the console with errors
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
return handler;
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
exports.withSentry = withSentry;
|
|
251
|
-
//# sourceMappingURL=handler.js.map
|