Skip to content

Commit 11eeccf

Browse files
committed
pr feedback
1 parent 6f3ecb0 commit 11eeccf

File tree

3 files changed

+27
-18
lines changed

3 files changed

+27
-18
lines changed

docs/platforms/javascript/common/troubleshooting/index.mdx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,6 @@ Most community CDNs properly set an `Access-Control-Allow-Origin` header.
9797

9898
<Expandable permalink title="Configure CSP for Client-side `fetch` Instrumentation">
9999

100-
<Alert>
101-
Only relevant for SvelteKit versions below `@sveltejs/[email protected]`
102-
</Alert>
103100
If you're using a SvelteKit version older than `sveltejs/[email protected]`, the Sentry SDK injects an inline `<script>` tag into the HTML response of the server.
104101
This script proxies all client-side `fetch` calls so that `fetch` calls inside your `load` functions are captured by the SDK.
105102
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).
@@ -110,7 +107,7 @@ You have multiple options to solve this CSP issue:
110107

111108
The easiest option is to update `@sveltejs/kit` to at least version `2.16.0` (or newer). The SDK will not inject the fetch proxy script as it's no longer necessary.
112109

113-
#### Option 2: Add Script Hash to CSP policy
110+
#### Option 2: Add Script Hash to CSP Policy
114111

115112
To enable the script, add an exception for the `sentryHandle` script by adding the hash of the script to your CSP script source rules.
116113

@@ -139,7 +136,7 @@ For external CSP configurations, add the following hash to your `script-src` dir
139136
consistent.
140137
</Alert>
141138

142-
#### Option 3: Disable `fetch` Proxy Script
139+
#### Option 3: Disable the `fetch` Proxy Script
143140

144141
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`:
145142

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

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ export default defineConfig({
147147

148148
## Step 3: Add Readable Stack Traces With Source Maps (Optional)
149149

150-
To upload source maps for clear error stack traces, add your Sentry auth token, organization, and project slug in your `vite.config.(js|ts)` file:
150+
To upload source maps for clear error stack traces, create an environment variable for your auth token and add your Sentry organization, and project slug in your `vite.config.(js|ts)` file:
151151

152152
```javascript {filename:vite.config.(js|ts)} {6-10}
153153
import { sveltekit } from "@sveltejs/kit/vite";
@@ -159,7 +159,7 @@ export default {
159159
sourceMapsUploadOptions: {
160160
org: "___ORG_SLUG___",
161161
project: "___PROJECT_SLUG___",
162-
authToken: "___ORG_AUTH_TOKEN___",
162+
authToken: process.env.SENTRY_AUTH_TOKEN,
163163
},
164164
}),
165165
sveltekit(),
@@ -168,6 +168,14 @@ export default {
168168
};
169169
```
170170

171+
To keep your auth token secure, always store it in an environment variable instead of directly in your files:
172+
173+
<OrgAuthTokenNote />
174+
175+
```bash {filename:.env}
176+
SENTRY_AUTH_TOKEN=___ORG_AUTH_TOKEN___
177+
```
178+
171179
### Override Adapter Detection
172180

173181
`sentrySvelteKit` tries to auto-detect your SvelteKit adapter to configure source maps upload correctly. If you're using an unsupported adapter or the wrong one is detected, set it using the `adapter` option:
@@ -187,7 +195,7 @@ export default {
187195
};
188196
```
189197

190-
## Step 3: Optional Configuration
198+
## Step 4: Optional Configuration
191199

192200
The points explain additional optional configuration or more in-depth customization of your Sentry SvelteKit SDK setup.
193201

@@ -302,16 +310,16 @@ export const GET = wrapServerRouteWithSentry(async () => {
302310
});
303311
```
304312

305-
## Step 4: Cloudflare Pages Configuration (Optional)
313+
## Step 5: Cloudflare Pages Configuration (Optional)
306314

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

310-
## Step 5: Avoid Ad Blockers With Tunneling (Optional)
318+
## Step 6: Avoid Ad Blockers With Tunneling (Optional)
311319

312320
<PlatformContent includePath="getting-started-tunneling" />
313321

314-
## Step 6: Verify Your Setup
322+
## Step 7: Verify Your Setup
315323

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

platform-includes/sourcemaps/upload/primer/javascript.sveltekit.mdx

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ There are two ways to set them:
99

1010
You can set all values as environment variables, for example, in a `.env` file:
1111

12+
<OrgAuthTokenNote />
13+
1214
```bash {filename: .env}
1315
# DO NOT commit this file to your repo. The auth token is a secret.
1416
SENTRY_AUTH_TOKEN=___ORG_AUTH_TOKEN___
@@ -23,8 +25,6 @@ SENTRY_URL="https://your-sentry-instance.com"
2325

2426
You can also set your org and project slugs by passing a `sourceMapsUploadOptions` object to `sentrySvelteKit`, as seen in the example below. For a full list of available options, see the [Sentry Vite Plugin documentation](https://www.npmjs.com/package/@sentry/vite-plugin#options).
2527

26-
<OrgAuthTokenNote />
27-
2828
```javascript {filename:vite.config.(js|ts)} {6-12}
2929
import { sveltekit } from "@sveltejs/kit/vite";
3030
import { sentrySvelteKit } from "@sentry/sveltekit";
@@ -35,7 +35,7 @@ export default {
3535
sourceMapsUploadOptions: {
3636
org: "___ORG_SLUG___",
3737
project: "___PROJECT_SLUG___",
38-
authToken: "process.env.SENTRY_AUTH_TOKEN",
38+
authToken: process.env.SENTRY_AUTH_TOKEN,
3939
// If you're self-hosting Sentry, also add your instance URL:
4040
// url: "https://your-self-hosted-sentry.com/",
4141
},
@@ -46,10 +46,14 @@ export default {
4646
};
4747
```
4848

49-
<Alert level="warning" title="Important">
50-
To keep your auth token secure, always store it in an environment variable
51-
instead of directly in your files.
52-
</Alert>
49+
To keep your auth token secure, always store it in an environment variable instead of directly in your files:
50+
51+
<OrgAuthTokenNote />
52+
53+
```bash {filename:.env}
54+
SENTRY_AUTH_TOKEN=___ORG_AUTH_TOKEN___
55+
```
56+
5357
### Override SvelteKit Adapter Detection
5458

5559
By default, `sentrySvelteKit` will try to detect your SvelteKit adapter to configure the source maps upload correctly. If you're not using one of the [supported adapters](/platforms/javascript/guides/sveltekit) or the wrong one is detected, you can override the adapter detection by passing the `adapter` option to `sentrySvelteKit`:

0 commit comments

Comments
 (0)