Skip to content

Commit d3e0ad5

Browse files
docs(js): Quick Start guides: Auth tokens in env files (#14159)
<!-- Use this checklist to make sure your PR is ready for merge. You may delete any sections you don't need. --> In this PR, I've updated the Source Maps section in the Quick Start guides (manual setup) to ensure we recommend storing the Sentry auth token in an environment file instead of directly in the config files. Updated for SDKs: - Nuxt - React Router Framework - Solidstart Closes: #13896 ## DESCRIBE YOUR PR *Tell us what you're changing and why. If your PR **resolves an issue**, please link it so it closes automatically.* ## IS YOUR CHANGE URGENT? Help us prioritize incoming PRs by letting us know when the change needs to go live. - [ ] Urgent deadline (GA date, etc.): <!-- ENTER DATE HERE --> - [ ] Other deadline: <!-- ENTER DATE HERE --> - [x] None: Not urgent, can wait up to 1 week+ ## SLA - Teamwork makes the dream work, so please add a reviewer to your PRs. - Please give the docs team up to 1 week to review your PR unless you've added an urgent due date to it. Thanks in advance for your help! ## PRE-MERGE CHECKLIST *Make sure you've checked the following before merging your changes:* - [ ] Checked Vercel preview for correctness, including links - [ ] PR was reviewed and approved by any necessary SMEs (subject matter experts) - [ ] PR was reviewed and approved by a member of the [Sentry docs team](https://github.com/orgs/getsentry/teams/docs) ## EXTRA RESOURCES - [Sentry Docs contributor guide](https://docs.sentry.io/contributing/) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1 parent 3e7b545 commit d3e0ad5

File tree

4 files changed

+201
-159
lines changed

4 files changed

+201
-159
lines changed

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

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,13 @@ description: "Learn how to manually set up Sentry in your Next.js app and captur
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", "logs"]}
19+
options={[
20+
"error-monitoring",
21+
"performance",
22+
"session-replay",
23+
"user-feedback",
24+
"logs",
25+
]}
2026
/>
2127

2228
<PlatformContent includePath="getting-started-features-expandable" />
@@ -90,6 +96,7 @@ export default withSentryConfig(nextConfig, {
9096
### Initialize Sentry Client-Side and Server-Side SDKs
9197

9298
Create three files in your application's root directory:
99+
93100
- `sentry.server.config.(js|ts)`
94101
- `sentry.edge.config.(js|ts)`
95102
- `instrumentation-client.(js|ts)`
@@ -220,7 +227,8 @@ Sentry.init({
220227
```
221228

222229
<Alert title="Tip">
223-
Include your DSN directly in these files, or use a _public_ environment variable like `NEXT_PUBLIC_SENTRY_DSN`.
230+
Include your DSN directly in these files, or use a _public_ environment
231+
variable like `NEXT_PUBLIC_SENTRY_DSN`.
224232
</Alert>
225233

226234
### Register Sentry Server-Side SDK Initialization
@@ -433,7 +441,7 @@ module.exports = withSentryConfig(nextConfig, {
433441
});
434442
```
435443

436-
Alternatively, set the `SENTRY_AUTH_TOKEN` environment variable in your `.env` file:
444+
Set the `SENTRY_AUTH_TOKEN` environment variable in your `.env` file:
437445

438446
```sh {filename:.env}
439447
SENTRY_AUTH_TOKEN=___ORG_AUTH_TOKEN___

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

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,13 @@ Add the following overrides:
5151
Choose the features you want to configure, and this guide will show you how:
5252

5353
<OnboardingOptionButtons
54-
options={["error-monitoring", "performance", "session-replay", "user-feedback", "logs"]}
54+
options={[
55+
"error-monitoring",
56+
"performance",
57+
"session-replay",
58+
"user-feedback",
59+
"logs",
60+
]}
5561
/>
5662

5763
<PlatformContent includePath="getting-started-features-expandable" />
@@ -218,20 +224,29 @@ Check out the <PlatformLink to="/install/cli-import">`--import` CLI flag</Platfo
218224

219225
To upload source maps for clear error stack traces, add your Sentry auth token, organization, and project slugs in the `sentry.sourceMapsUploadOptions` inside your configuration file:
220226

221-
```javascript {filename:nuxt.config.ts} {3-9}
227+
<Alert>These `sentry` options only affect the **build time** of the SDK.</Alert>
228+
229+
```javascript {filename:nuxt.config.ts} {3-10}
222230
export default defineNuxtConfig({
223231
modules: ["@sentry/nuxt/module"],
224232
sentry: {
225233
sourceMapsUploadOptions: {
226234
org: "___ORG_SLUG___",
227235
project: "___PROJECT_SLUG___",
228-
authToken: "___ORG_AUTH_TOKEN___",
236+
// store your auth token in an environment variable
237+
authToken: process.env.SENTRY_AUTH_TOKEN,
229238
},
230239
},
231240
});
232241
```
233242

234-
<Alert>These `sentry` options only affect the **build time** of the SDK.</Alert>
243+
To keep your auth token secure, always store it in an environment variable instead of directly in your files:
244+
245+
<OrgAuthTokenNote />
246+
247+
```bash {filename:.env}
248+
SENTRY_AUTH_TOKEN=___ORG_AUTH_TOKEN___
249+
```
235250

236251
While Nuxt generates source maps on the server side by default, you need to explicitly enable client-side source maps in your Nuxt configuration:
237252

0 commit comments

Comments
 (0)