Skip to content

Commit bff9631

Browse files
sfanahataShannon Anahatasergical
authored
Nextjs source map doc updates (#14433)
## DESCRIBE YOUR PR Updating the source map includes for nexjs to bring back the explainer on why source maps are so important, and give a little bit of detail around configuring. Removing the nodejs blog post link from the javascript sourcemap doc. It's outdated, and it's irrelevant to the other frameworks. We can always add it into the node.js includes if we want it back, though it should be updated if we want it back. ## 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) --------- Co-authored-by: Shannon Anahata <shannonanahata@gmail.com> Co-authored-by: Sergiy Dybskiy <sergiy.dybskiy@sentry.io>
1 parent 01dc710 commit bff9631

File tree

3 files changed

+81
-5
lines changed

3 files changed

+81
-5
lines changed
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Source Maps
33
sidebar_order: 3
4-
description: "Upload your source maps to Sentry to enable readable stack traces in your errors, along with other numerous benefits. Learn more here."
4+
description: "Upload your source maps to Sentry to enable readable stack traces in your errors."
55
---
66

77
<PlatformContent includePath="sourcemaps/primer" />
@@ -11,5 +11,4 @@ description: "Upload your source maps to Sentry to enable readable stack traces
1111
## Additional Resources
1212

1313
- [Using sentry-cli to Upload Source Maps](/cli/releases/#sentry-cli-sourcemaps)
14-
- [4 Reasons Why Your Source Maps Are Broken](https://blog.sentry.io/2018/10/18/4-reasons-why-your-source-maps-are-broken)
15-
- [Debug Your Node.js Projects with Source Maps](https://blog.sentry.io/2019/02/20/debug-node-source-maps)
14+
- [4 Reasons Why Your Source Maps Are Broken](https://blog.sentry.io/2018/10/18/4-reasons-why-your-source-maps-are-broken)
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
### Manual Configuration
2+
If you installed the SDK manually or the wizard failed, follow the steps below to manually configure source maps upload.
3+
4+
#### 1. Configure Source Maps Upload
5+
6+
To automatically upload source maps, you need to provide your Sentry auth token, organization, and project slugs in your Next.js configuration:
7+
8+
<OrgAuthTokenNote />
9+
10+
**Make sure you add your auth token to your CI, if you are using one to deploy your application.**
11+
12+
Add your auth token to your environment:
13+
14+
```bash {filename:.env.local}
15+
SENTRY_AUTH_TOKEN=___ORG_AUTH_TOKEN___
16+
```
17+
18+
```javascript {filename:next.config.js}
19+
const { withSentryConfig } = require("@sentry/nextjs");
20+
21+
module.exports = withSentryConfig(
22+
{
23+
// your existing Next.js config
24+
},
25+
{
26+
org: "___ORG_SLUG___",
27+
project: "___PROJECT_SLUG___",
28+
authToken: process.env.SENTRY_AUTH_TOKEN,
29+
}
30+
);
31+
```
32+
33+
#### 2. Source Map Options
34+
35+
Configure source map behavior using the [source maps options](/platforms/javascript/guides/nextjs/configuration/build/#source-maps-options) in your Next.js config:
36+
37+
```javascript {11-16} {filename:next.config.js}
38+
const { withSentryConfig } = require("@sentry/nextjs");
39+
40+
module.exports = withSentryConfig(
41+
{
42+
// your existing Next.js config
43+
},
44+
{
45+
org: "___ORG_SLUG___",
46+
project: "___PROJECT_SLUG___",
47+
authToken: process.env.SENTRY_AUTH_TOKEN,
48+
sourcemaps: {
49+
disable: false, // Enable source maps (default: false)
50+
assets: ["**/*.js", "**/*.js.map"], // Specify which files to upload
51+
ignore: ["**/node_modules/**"], // Files to exclude
52+
deleteSourcemapsAfterUpload: true, // Security: delete after upload
53+
},
54+
}
55+
);
56+
```
57+
### Turbopack Considerations
58+
59+
**Important:** The Sentry SDK doesn't yet fully support Turbopack production builds (`next build --turbopack`) as Turbopack production builds are still in alpha.
60+
61+
- **Turbopack dev mode** (`next dev --turbopack`) is fully supported for Next.js 15.3.0+
62+
- **Turbopack production builds** are not currently supported for source map upload
63+
- If you're using Turbopack, remove the `--turbo` flag for production builds until full support is available
64+
65+
Check the latest information on [Sentry's support for Turbopack on GitHub](https://github.com/getsentry/sentry-javascript/issues/8105).
66+
67+
### Troubleshooting
68+
69+
If you're experiencing issues with source maps, see [Troubleshooting Source Maps](/platforms/javascript/guides/nextjs/sourcemaps/troubleshooting_js/).
Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1-
`@sentry/nextjs` will generate and upload source maps automatically, in order to enable errors to have readable stack traces.
1+
`@sentry/nextjs` will generate and upload source maps automatically. You must have source maps enabled in order to have readable stack traces.
22

3-
To upload source maps, the `@sentry/nextjs` SDK uses the Sentry webpack plugin under the hood. See the [Build Options](../configuration/build/#source-maps-options) page and the Sentry [webpack plugin documentation](https://www.npmjs.com/package/@sentry/webpack-plugin) for more details. If you are using Vercel, then you can also use the [Vercel integration](/organization/integrations/deployment/vercel/) to upload source maps during deployments automatically.
3+
The easiest way to configure uploading source maps is by using the [Sentry Wizard](/platforms/javascript/guides/nextjs/#step-1-install).
4+
5+
The `@sentry/nextjs` SDK uses the Sentry webpack plugin under the hood to upload source maps. See the [Build Options](../configuration/build/#source-maps-options) page and the Sentry [webpack plugin documentation](https://www.npmjs.com/package/@sentry/webpack-plugin) for more details. If you are using Vercel, then you can also use the [Vercel integration](/organization/integrations/deployment/vercel/) to upload source maps during deployments automatically.
6+
7+
**Note:** Source maps are only generated and uploaded during **production builds** (`next build`). Development builds (`next dev`) do not generate source maps for upload.
8+
9+
See how uploading source maps lets you see the exact line of code that caused an error:
10+
11+
<Arcade src="https://demo.arcade.software/OFrHpZUU739XKR8qUiEP?embed" />

0 commit comments

Comments
 (0)