|
| 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/). |
0 commit comments