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
Other adapters may work but aren't currently supported. We're looking into extending first-class support to more adapters in the future.
28
+
29
+
Also, Sentry's SvelteKit SDK does not yet work with all non-node server runtimes, such as Vercel's edge runtime.
30
+
31
+
</Expandable>
13
32
14
33
## Step 1: Install
15
34
@@ -45,7 +64,7 @@ You need to initialize and configure the Sentry SDK in three places: the client
45
64
46
65
### Configure Client-side Sentry
47
66
48
-
Create a client hooks file `src/hooks.client.(js|ts)` if you don't have one already. In this file, import and initialize the Sentry SDK, specifying any SDK options for the client. Add the `handleErrorWithSentry` function to the [`handleError` hook](https://svelte.dev/docs/kit/hooks#Shared-hooks-handleError).
67
+
Create a client hooks file `src/hooks.client.(js|ts)` if you don't have one already. In this file, import and initialize the Sentry SDK and add the `handleErrorWithSentry` function to the [`handleError` hook](https://svelte.dev/docs/kit/hooks#Shared-hooks-handleError).
Create a server hooks file `src/hooks.server.(js|ts)` if you don't have one already. In this file, import and initialize the Sentry SDK, specifying any SDK options for the client. Additionally, add the `handleErrorWithSentry` function to the [`handleError` hook](https://svelte.dev/docs/kit/hooks#Shared-hooks-handleError) and add the Sentry request handler to the [`handle` hook](https://kit.svelte.dev/docs/hooks#server-hooks-handle).
111
+
Create a server hooks file `src/hooks.server.(js|ts)` if you don't have one already. In this file, import and initialize the Sentry SDK and add the `handleErrorWithSentry` function to the [`handleError` hook](https://svelte.dev/docs/kit/hooks#Shared-hooks-handleError) and the Sentry request handler to the [`handle` hook](https://kit.svelte.dev/docs/hooks#server-hooks-handle).
@@ -411,11 +430,11 @@ Follow this guide to [configure Sentry for Cloudflare](/platforms/javascript/gui
411
430
412
431
You can prevent ad blockers from blocking Sentry events using tunneling. Use the `tunnel` option to add an API endpoint in your application that forwards Sentry events to Sentry servers.
413
432
414
-
Update `Sentry.init` file with the following options:
433
+
Update `Sentry.init`in your `hooks.client.(js|ts)`file with the following option:
@@ -428,9 +447,9 @@ Let's test your setup and confirm that Sentry is working correctly and sending d
428
447
429
448
### Issues
430
449
431
-
To verify that Sentry captures errors and creates issues in your Sentry project, create a test page, for example at `src/routes/sentry-example/+page.svelte` with a button:
450
+
To verify that Sentry captures errors and creates issues in your Sentry project, create a test page, for example, at `src/routes/sentry-example/+page.svelte` with a button that throws an error when clicked:
432
451
433
-
```javascript
452
+
```javascript {filename:+page.svelte}
434
453
<button
435
454
type="button"
436
455
onclick={() => {
@@ -452,15 +471,15 @@ To verify that Sentry captures errors and creates issues in your Sentry project,
452
471
### Tracing
453
472
To test tracing, create a test API route like `src/routes/sentry-example/+server.(js|ts)`:
454
473
455
-
```javascript
474
+
```javascript {filename:+server.(js|ts)}
456
475
exportconstGET=async () => {
457
476
thrownewError("Sentry Example API Route Error");
458
477
};
459
478
```
460
479
461
480
Next, update your test button to call this route and throw an error if the response isn't `ok`:
0 commit comments