Skip to content

Commit 99b0d15

Browse files
committed
init SDK configured for CF in dev mode
1 parent fee1d2b commit 99b0d15

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

packages/sveltekit/src/server/handle.ts

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,22 @@ export function isFetchProxyRequired(version: string): boolean {
150150
}
151151

152152
/**
153-
* actual implementation in ../worker/handle.ts
154-
* @return no-op handler when initCLoudflareSentryHandle is called via node/server entry point
153+
* Actual implementation in ../worker/handle.ts
154+
*
155+
* This handler initializes the Sentry Node(!) SDK with the passed options. This is necessary to get
156+
* the SDK configured for cloudflare working in dev mode.
157+
*
158+
* @return version of initCLoudflareSentryHandle that is called via node/server entry point
155159
*/
156-
export function initCloudflareSentryHandle(_options: unknown): Handle {
157-
return ({ event, resolve }) => resolve(event);
160+
export function initCloudflareSentryHandle(options: CloudflareOptions): Handle {
161+
let sentryInitialized = false;
162+
163+
return ({ event, resolve }) => {
164+
if (!sentryInitialized) {
165+
sentryInitialized = true;
166+
init(options);
167+
}
168+
169+
return resolve(event);
170+
};
158171
}

0 commit comments

Comments
 (0)