Skip to content

Commit d632f2d

Browse files
committed
sveltekit build options and apis content update
1 parent fb1d451 commit d632f2d

File tree

4 files changed

+68
-72
lines changed

4 files changed

+68
-72
lines changed

docs/platforms/javascript/common/apis.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1085,7 +1085,7 @@ Wraps a callback with a cron monitor check in. The check in will be sent to Sent
10851085
<PlatformSection supported={["javascript.sveltekit"]}>
10861086
## Load Function Instrumentation
10871087

1088-
SvelteKit's universal and server `load` functions are instrumented automatically by default. If you don't want to use `load` auto-instrumentation, you can [disable it](/platforms/javascript/guides/sveltekit/configuration/build/) and manually instrument specific `load` functions using the following function wrappers:
1088+
SvelteKit's universal and server `load` functions are instrumented automatically by default. If you don't want to use `load` auto-instrumentation, you can [disable it](/platforms/javascript/guides/sveltekit/configuration/build/#auto-instrumentation-options) and manually instrument specific `load` functions using the following function wrappers:
10891089

10901090
<SdkApi
10911091
name="wrapLoadWithSentry"

docs/platforms/javascript/guides/sveltekit/configuration/build/index.mdx

Lines changed: 57 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,25 +26,25 @@ The Sentry SvelteKit SDK supports automatic code instrumentation and source map
2626

2727
<SdkOption name="sourceMapsUploadOptions.org" type="string" envVar="SENTRY_ORG">
2828

29-
For details on this option, refer to the [Sentry Vite plugin documentation](https://www.npmjs.com/package/@sentry/vite-plugin#org).
29+
The slug of the Sentry organization associated with the app.
3030

3131
</SdkOption>
3232

3333
<SdkOption name="sourceMapsUploadOptions.project" type="string" envVar="SENTRY_PROJECT">
3434

35-
For details on this option, refer to the [Sentry Vite plugin documentation](https://www.npmjs.com/package/@sentry/vite-plugin#project).
35+
The slug of the Sentry project associated with the app.
3636

3737
</SdkOption>
3838

3939
<SdkOption name="sourceMapsUploadOptions.authToken" type="string" envVar="SENTRY_AUTH_TOKEN">
4040

41-
For details on this option, refer to the [Sentry Vite plugin documentation](https://www.npmjs.com/package/@sentry/vite-plugin#authtoken).
41+
The authentication token to use for all communication with Sentry. Can be obtained from https://sentry.io/orgredirect/organizations/:orgslug/settings/auth-tokens/.
4242

4343
</SdkOption>
4444

4545
<SdkOption name="sourceMapsUploadOptions.url" type="string" envVar="SENTRY_URL" defaultValue="https://sentry.io/">
4646

47-
For details on this option, refer to the [Sentry Vite plugin documentation](https://www.npmjs.com/package/@sentry/vite-plugin#url).
47+
The base URL of your Sentry instance. Only relevant if you're using a self-hosted or Sentry instance other than sentry.io.
4848

4949
</SdkOption>
5050

@@ -70,14 +70,29 @@ However, you can customize the behavior or disable it entirely.
7070
<Alert>
7171
The SDK will only auto-instrument `load` functions in `+page` or `+layout`
7272
files that don't contain any Sentry-related code. If you have custom Sentry
73-
code in these files, you'll have to [manually add the Sentry
74-
wrapper](/platforms/javascript/guides/sveltekit/apis) to your `load`
75-
functions.
73+
code in these files, you'll have to [manually add a Sentry
74+
wrapper](/platforms/javascript/guides/sveltekit/apis/#load-function-instrumentation)
75+
to your `load` functions.
7676
</Alert>
7777

7878
<SdkOption name="autoInstrument" type="boolean | object" defaultValue="true">
7979

80-
Set `autoInstrument` to `false` to disable auto-instrumentation of any `load` functions. You can still [manually instrument](/platforms/javascript/guides/sveltekit/apis) specific `load` functions.
80+
Set `autoInstrument` to `false` to disable auto-instrumentation of any `load` functions. You can still [manually instrument](/platforms/javascript/guides/sveltekit/apis/#load-function-instrumentation) specific `load` functions.
81+
82+
```javascript {filename:vite.config.(js|ts)} {7}
83+
import { sveltekit } from '@sveltejs/kit/vite';
84+
import { sentrySvelteKit } from '@sentry/sveltekit';
85+
86+
export default {
87+
plugins: [
88+
sentrySvelteKit({
89+
autoInstrument: false;
90+
}),
91+
sveltekit(),
92+
],
93+
// ... rest of your Vite config
94+
};
95+
```
8196

8297
Alternatively, you can provide `autoInstrument` with an object to customize which `load` functions should be instrumented.
8398

@@ -87,10 +102,44 @@ Alternatively, you can provide `autoInstrument` with an object to customize whic
87102

88103
Set to `false` to disable auto-instrumentation of `load` functions inside `+page.(js|ts)` or `+layout.(js|ts)`.
89104

105+
```javascript {filename:vite.config.(js|ts)} {7-10}
106+
import { sveltekit } from "@sveltejs/kit/vite";
107+
import { sentrySvelteKit } from "@sentry/sveltekit";
108+
109+
export default {
110+
plugins: [
111+
sentrySvelteKit({
112+
autoInstrument: {
113+
load: false,
114+
},
115+
}),
116+
sveltekit(),
117+
],
118+
// ... rest of your Vite config
119+
};
120+
```
121+
90122
</SdkOption>
91123

92124
<SdkOption name="autoInstrument.serverLoad" type="boolean" defaultValue="true">
93125

94126
Set to `false` to disable auto-instrumentation of server-only `load` functions inside `+page.server.(js|ts)` or `+layout.server.(js|ts)`.
95127

128+
```javascript {filename:vite.config.(js|ts)} {7-10}
129+
import { sveltekit } from "@sveltejs/kit/vite";
130+
import { sentrySvelteKit } from "@sentry/sveltekit";
131+
132+
export default {
133+
plugins: [
134+
sentrySvelteKit({
135+
autoInstrument: {
136+
serverLoad: false,
137+
},
138+
}),
139+
sveltekit(),
140+
],
141+
// ... rest of your Vite config
142+
};
143+
```
144+
96145
</SdkOption>

docs/platforms/javascript/guides/sveltekit/manual-setup.mdx

Lines changed: 9 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,12 @@ description: "Learn how to manually set up Sentry in your SvelteKit app and capt
1616
Choose the features you want to configure, and this guide will show you how:
1717

1818
<OnboardingOptionButtons
19-
options={["error-monitoring", "performance", "session-replay", "user-feedback"]}
19+
options={[
20+
"error-monitoring",
21+
"performance",
22+
"session-replay",
23+
"user-feedback",
24+
]}
2025
/>
2126

2227
<PlatformContent includePath="getting-started-features-expandable" />
@@ -206,74 +211,16 @@ export default {
206211
};
207212
```
208213

209-
## Step 4: Optional Configuration
210-
211-
The points explain additional optional configuration or more in-depth customization of your Sentry SvelteKit SDK setup.
212-
213-
### Auto-Instrumentation
214-
215-
The SDK primarily uses [SvelteKit's hooks](https://kit.svelte.dev/docs/hooks) to collect error and performance data. However, SvelteKit doesn't yet offer a hook for universal or server-only `load` function calls. Therefore, the SDK uses a Vite plugin to auto-instrument `load` functions so that you don't have to add a Sentry wrapper to each function manually.
216-
217-
Auto-instrumentation is enabled by default when you add the `sentrySvelteKit()` function call to your `vite.config.(js|ts)`. However, you can customize the behavior, or disable it entirely. If you disable it you can still manually wrap specific `load` functions with the `withSentry` function.
218-
219-
<Alert>
220-
221-
The SDK will only auto-instrument `load` functions in `+page` or `+layout` files that don't contain any Sentry code.
222-
If you have custom Sentry code in these files, you'll have to [manually](#instrument-load-functions-manually) add the Sentry wrapper to your `load` functions.
223-
224-
</Alert>
225-
226-
#### Customize Auto-instrumentation
227-
228-
By passing the `autoInstrument` option to `sentrySvelteKit` you can disable auto-instrumentation entirely, or customize which `load` functions should be instrumented:
229-
230-
```javascript {filename:vite.config.(js|ts)} {7-10}
231-
import { sveltekit } from "@sveltejs/kit/vite";
232-
import { sentrySvelteKit } from "@sentry/sveltekit";
233-
234-
export default {
235-
plugins: [
236-
sentrySvelteKit({
237-
autoInstrument: {
238-
load: true,
239-
serverLoad: false,
240-
},
241-
}),
242-
sveltekit(),
243-
],
244-
// ... rest of your Vite config
245-
};
246-
```
247-
248-
#### Disable Auto-instrumentation
249-
250-
If you set the `autoInstrument` option to `false`, the SDK won't auto-instrument any `load` functions. You can still [manually instrument](#instrument-load-functions-manually) specific `load` functions.
251-
252-
```javascript {filename:vite.config.(js|ts)} {7}
253-
import { sveltekit } from '@sveltejs/kit/vite';
254-
import { sentrySvelteKit } from '@sentry/sveltekit';
255-
256-
export default {
257-
plugins: [
258-
sentrySvelteKit({
259-
autoInstrument: false;
260-
}),
261-
sveltekit(),
262-
],
263-
// ... rest of your Vite config
264-
};
265-
```
266-
267-
## Step 5: Cloudflare Pages Configuration (Optional)
214+
## Step 4: Cloudflare Pages Configuration (Optional)
268215

269216
If you're deploying your application to Cloudflare Pages, you need to adjust your server-side setup.
270217
Follow this guide to [configure Sentry for Cloudflare](/platforms/javascript/guides/cloudflare/frameworks/sveltekit/).
271218

272-
## Step 6: Avoid Ad Blockers With Tunneling (Optional)
219+
## Step 5: Avoid Ad Blockers With Tunneling (Optional)
273220

274221
<PlatformContent includePath="getting-started-tunneling" />
275222

276-
## Step 7: Verify Your Setup
223+
## Step 6: Verify Your Setup
277224

278225
Let's test your setup and confirm that Sentry is working correctly and sending data to your Sentry project.
279226

src/components/sdkOption.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export function SdkOption({
3232
{defaultValue && <OptionDefRow label="Default" value={defaultValue} />}
3333

3434
<PlatformCategorySection supported={['server', 'serverless']}>
35-
<PlatformSection notSupported={['javascript.nextjs']}>
35+
<PlatformSection notSupported={['javascript.nextjs', 'javascript.sveltekit']}>
3636
{envVar && <OptionDefRow label="ENV Variable" value={envVar} />}
3737
</PlatformSection>
3838
</PlatformCategorySection>

0 commit comments

Comments
 (0)