Skip to content

Commit 071fb99

Browse files
committed
pr feedback
1 parent b653bab commit 071fb99

File tree

1 file changed

+17
-49
lines changed

1 file changed

+17
-49
lines changed

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

Lines changed: 17 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -9,29 +9,7 @@ description: "Learn how to manually set up Sentry in your SvelteKit app and capt
99
installer](/platforms/javascript/guides/sveltekit).
1010
</Alert>
1111

12-
## Prerequisites
13-
14-
You need:
15-
16-
- A Sentry [account](https://sentry.io/signup/) and [project](/product/projects/)
17-
- Your application up and running
18-
19-
<Expandable title="Notes on SvelteKit adapter compatibility">
20-
The SvelteKit Sentry SDK is designed to work out of the box with several SvelteKit adapters and their underlying server runtimes.
21-
Here's an overview of the current support:
22-
23-
- **Fully supported Node.js runtimes**
24-
- [Adapter-auto](https://kit.svelte.dev/docs/adapter-auto) for Vercel; other Node.js-based platforms might work, but we don't guarantee compatibility at this time
25-
- [Adapter-vercel](https://kit.svelte.dev/docs/adapter-vercel) when used with Vercel's Node.js Lambda runtime
26-
- [Adapter-node](https://kit.svelte.dev/docs/adapter-node)
27-
- **Supported non-Node.js runtimes**
28-
- [Adapter-cloudflare](https://kit.svelte.dev/docs/adapter-cloudflare) requires [additional setup](/platforms/javascript/guides/cloudflare/frameworks/sveltekit/)
29-
- **Currently not supported**
30-
- Non-Node.js server runtimes, such as Vercel's edge runtime, are not yet supported.
31-
- **Other adapters**
32-
- Other SvelteKit adapters might work, but they're not currently officially supported. We're looking into extending first-class support to more adapters in the future.
33-
34-
</Expandable>
12+
<PlatformContent includePath="getting-started-prerequisites" />
3513

3614
## Step 1: Install
3715

@@ -146,16 +124,9 @@ export const handle = Sentry.sentryHandle();
146124
// export const handle = sequence(Sentry.sentryHandle(), yourHandler());
147125
```
148126

149-
<Alert level="warning" title="Important">
150-
For development, you can include your [Data Source
151-
Name](/concepts/key-terms/dsn-explainer/) (DSN) directly in these files.
152-
However, in production, we strongly recommend you use an environment variable
153-
to avoid accidentally exposing your DSN in the codebase.
154-
</Alert>
155-
156127
### Configure Vite
157128

158-
Add `sentrySvelteKit` to your plugins before `sveltekit` in your `vite.config.(js|ts)` file to automatically upload source maps to Sentry and instrument `load` functions for tracing if it's configured.
129+
Add the `sentrySvelteKit` plugin **before** `sveltekit` in your `vite.config.(js|ts)` file to automatically upload source maps to Sentry and instrument `load` functions for tracing if it's configured.
159130

160131
```javascript {filename:vite.config.(js|ts)} {2,6}
161132
import { sveltekit } from "@sveltejs/kit/vite";
@@ -453,15 +424,14 @@ Let's test your setup and confirm that Sentry is working correctly and sending d
453424

454425
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:
455426

456-
```javascript {filename:+page.svelte}
457-
<button
458-
type="button"
459-
onclick={() => {
427+
```html {filename:+page.svelte}
428+
<script>
429+
function throwTestError() {
460430
throw new Error("Sentry Example Frontend Error");
461-
}}
462-
>
463-
Throw error
464-
</button>
431+
}
432+
</script>
433+
434+
<button type="button" onclick="{throwTestError}">Throw error</button>
465435
```
466436

467437
<OnboardingOption optionId="performance" hideForThisOption>
@@ -483,29 +453,27 @@ export const GET = async () => {
483453

484454
Next, update your test button to call this route and throw an error if the response isn't `ok`:
485455

486-
```javascript {filename:+page.svelte}
456+
```html {filename:+page.svelte}
487457
<script>
488-
import * as Sentry from '@sentry/sveltekit';
458+
import * as Sentry from "@sentry/sveltekit";
489459
490-
function getSentryData() {
460+
function throwTestError() {
491461
Sentry.startSpan(
492462
{
493-
name: 'Example Frontend Span',
494-
op: 'test'
463+
name: "Example Frontend Span",
464+
op: "test",
495465
},
496466
async () => {
497-
const res = await fetch('/sentry-example');
467+
const res = await fetch("/sentry-example");
498468
if (!res.ok) {
499-
throw new Error('Sentry Example Frontend Error');
469+
throw new Error("Sentry Example Frontend Error");
500470
}
501471
}
502472
);
503473
}
504474
</script>
505475

506-
<button type="button" onclick={handleClick}>
507-
Throw error with trace
508-
</button>
476+
<button type="button" onclick="{throwTestError}">Throw error with trace</button>
509477
```
510478

511479
Open the page `sentry-example` in a browser and click the button to trigger two errors:

0 commit comments

Comments
 (0)