Skip to content

Commit d7ce7b0

Browse files
author
Shannon Anahata
committed
updating the nextjs source maps primer and overview
1 parent bf143ff commit d7ce7b0

File tree

2 files changed

+69
-0
lines changed

2 files changed

+69
-0
lines changed
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
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+
Add your auth token to your environment:
11+
12+
```bash {filename:.env.local}
13+
SENTRY_AUTH_TOKEN=___ORG_AUTH_TOKEN___
14+
```
15+
16+
```javascript {filename:next.config.js}
17+
const { withSentryConfig } = require("@sentry/nextjs");
18+
19+
module.exports = withSentryConfig(
20+
{
21+
// your existing Next.js config
22+
},
23+
{
24+
org: "___ORG_SLUG___",
25+
project: "___PROJECT_SLUG___",
26+
authToken: process.env.SENTRY_AUTH_TOKEN,
27+
}
28+
);
29+
```
30+
31+
#### 2. Source Map Options
32+
33+
Configure source map behavior using the [source maps options](/platforms/javascript/guides/nextjs/configuration/build/#source-maps-options) in your Next.js config:
34+
35+
```javascript {filename:next.config.js}
36+
const { withSentryConfig } = require("@sentry/nextjs");
37+
38+
module.exports = withSentryConfig(
39+
{
40+
// your existing Next.js config
41+
},
42+
{
43+
org: "___ORG_SLUG___",
44+
project: "___PROJECT_SLUG___",
45+
authToken: process.env.SENTRY_AUTH_TOKEN,
46+
sourcemaps: {
47+
disable: false, // Enable source maps (default: false)
48+
assets: ["**/*.js", "**/*.js.map"], // Specify which files to upload
49+
ignore: ["**/node_modules/**"], // Files to exclude
50+
deleteSourcemapsAfterUpload: true, // Security: delete after upload
51+
},
52+
}
53+
);
54+
```
55+
### Turbopack Considerations
56+
57+
**Important:** The Sentry SDK doesn't yet fully support Turbopack production builds (`next build --turbopack`) as Turbopack production builds are still in alpha.
58+
59+
- **Turbopack dev mode** (`next dev --turbopack`) is fully supported for Next.js 15.3.0+
60+
- **Turbopack production builds** are not currently supported for source map upload
61+
- If you're using Turbopack, remove the `--turbo` flag for production builds until full support is available
62+
63+
Check the latest information on [Sentry's support for Turbopack on GitHub](https://github.com/getsentry/sentry-javascript/issues).
64+
65+
### Troubleshooting
66+
67+
If you're experiencing issues with source maps, see [Troubleshooting Source Maps](/platforms/javascript/guides/nextjs/sourcemaps/troubleshooting_js/).

platform-includes/sourcemaps/primer/javascript.nextjs.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ The easiest way to configure uploading source maps is by using the [Sentry Wizar
44

55
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.
66

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+
79
Learn how Sentry unminifies your JavaScript code by watching this video.
810

911
<VimeoEmbed id="956055420?h=f428eeda43" />

0 commit comments

Comments
 (0)