From 0be4a56bb3bd8aaffb4bf9d0320653f9814f831b Mon Sep 17 00:00:00 2001 From: Lukas Stracke Date: Tue, 15 Oct 2024 10:04:17 +0200 Subject: [PATCH] fix(cloudflare): Improve SvelteKit framework guide code block --- .../javascript/guides/cloudflare/frameworks/sveltekit.mdx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/platforms/javascript/guides/cloudflare/frameworks/sveltekit.mdx b/docs/platforms/javascript/guides/cloudflare/frameworks/sveltekit.mdx index 18c2841caaf7b..5d89186a89b0b 100644 --- a/docs/platforms/javascript/guides/cloudflare/frameworks/sveltekit.mdx +++ b/docs/platforms/javascript/guides/cloudflare/frameworks/sveltekit.mdx @@ -25,9 +25,9 @@ compatibility_flags = ["nodejs_compat"] # compatibility_flags = ["nodejs_als"] ``` -To use this SDK, update your `src/hooks.server.ts` file to use the `Sentry.wrapRequestHandler` method from the Sentry Cloudflare SDK and remove the `Sentry.init` call from `@sentry/sveltekit`. +To use this SDK, update your `src/hooks.server.(ts|js)` file to use the `Sentry.wrapRequestHandler` method from the Sentry Cloudflare SDK and remove the `Sentry.init` call from `@sentry/sveltekit`. -```diff +```typescript diff {filename:hooks.server.(ts|js)} import { sequence } from "@sveltejs/kit/hooks"; import { handleErrorWithSentry, sentryHandle } from "@sentry/sveltekit"; -import * as Sentry from '@sentry/sveltekit'; @@ -59,6 +59,8 @@ To use this SDK, update your `src/hooks.server.ts` file to use the `Sentry.wrapR -// If you have custom handlers, make sure to place them after `sentryHandle()` in the `sequence` function. -export const handle = sequence(sentryHandle()); +export const handle = sequence(handleInitSentry, sentryHandle()); + +export const handleError = handleErrorWithSentry(myErrorHandler); ``` If you need to use environmental variables, you can access them using `event.platform.env`.