You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/platforms/javascript/guides/sveltekit/manual-setup.mdx
+22-15Lines changed: 22 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -33,7 +33,6 @@ If you don't already have a [client hooks](https://kit.svelte.dev/docs/hooks#sha
33
33
At the top of your client hooks file, import and initialize the Sentry SDK as shown in the snippet below. See the [Basic Options](../configuration/options/) page to view other SDK configuration options.
34
34
Also, add the `handleErrorWithSentry` function to the [`handleError` hook](https://kit.svelte.dev/docs/hooks#shared-hooks-handleerror):
@@ -68,7 +67,6 @@ At the top of your server hooks file, import and initialize the Sentry SDK as sh
68
67
Add the `handleErrorWithSentry` function to the [`handleError` hook](https://kit.svelte.dev/docs/hooks#shared-hooks-handleerror) and add the Sentry request handler to the [`handle` hook](https://kit.svelte.dev/docs/hooks#server-hooks-handle).
69
68
If you're already using your own handler(s), use SvelteKit's [`sequence`](https://kit.svelte.dev/docs/modules#sveltejs-kit-hooks-sequence) function to add the Sentry handler _before_ your handler(s).
#### Configure CSP for Client-side `fetch` Instrumentation
264
261
265
262
<Note>
266
263
@@ -271,32 +268,42 @@ Available since version `7.91.0`
271
268
The `sentryHandle` function you added to your `handle` hook in `hooks.server.ts` during [server-side setup](#server-side-setup) injects an inline `<script>` tag into the HTML response of the server.
272
269
This script attempts to proxy all client-side `fetch` calls, so that `fetch` calls inside your `load` functions are captured by the SDK.
273
270
However, if you configured CSP rules to block inline fetch scripts by default, this script will be [blocked by the browser](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/script-src#unsafe_inline_script).
274
-
To enable the script, you need to add an exception for the `sentryHandle` script:
275
-
276
-
First, specify your nonce in the `fetchProxyScriptNonce` option in your `sentryHandle` call:
We will not make changes to this script any time soon (in fact, this script will be removed in version 9 of the SDK).
295
+
296
+
<Note>
297
+
298
+
Previous versions of this documentation recommended setting a nonce in your `sentryHandle` options.
299
+
We no longer recommend this approach due to security concerns with re-using nonces.
300
+
Instead, we recommend setting the hash as outlined above.
301
+
302
+
</Note>
303
+
297
304
##### Disable Client-side `fetch` Proxy Script
298
305
299
-
If you do not want to inject the script responsible for instrumenting client-side `load` calls, you can disable injection by passing `injectFetchProxyScript: false` to `sentryHandle`:
306
+
If you don't want to inject the script responsible for instrumenting client-side `fetch` calls, you can disable injection by passing `injectFetchProxyScript: false` to `sentryHandle`:
0 commit comments