Source Maps
Upload your source maps to Sentry to enable readable stack traces in your errors.
Source maps translate minified production code back to your original source, giving you readable stack traces instead of cryptic line numbers.
The SDK handles this automatically. When you run next build, source maps are generated and uploaded to Sentry. No extra configuration needed if you used the Sentry Wizard.
Source maps are only uploaded during production builds (next build). Development builds (next dev) don't generate uploads.
Deploying with Vercel? You can also use the Vercel integration for automatic uploads during deployment.
See how source maps transform your error reports:
If you installed the SDK manually or the wizard didn't complete, configure source map uploads:
Add your Sentry auth token to your environment. Make sure to also add it to your CI.
.env.localSENTRY_AUTH_TOKEN=___ORG_AUTH_TOKEN___
Add withSentryConfig to your Next.js config with your org, project, and auth token.
With Turbopack (Next.js 15+ default), source maps upload after the build completes.
Requires @sentry/nextjs@10.13.0+ and next@15.4.1+.
next.config.tsimport type { NextConfig } from "next";
import { withSentryConfig } from "@sentry/nextjs";
const nextConfig: NextConfig = {
// your existing Next.js config
};
export default withSentryConfig(nextConfig, {
org: "___ORG_SLUG___",
project: "___PROJECT_SLUG___",
authToken: process.env.SENTRY_AUTH_TOKEN,
});
| Option | Default | Description |
|---|---|---|
sourcemaps.deleteSourcemapsAfterUpload | true | Delete client-side source maps after upload. Server source maps are kept for runtime error reporting. |
widenClientFileUpload | false | Upload dependency source maps to fix [native code] frames |
See Build Options for all available options.
If you're using Webpack instead of Turbopack, source maps are uploaded during the build (not after). The configuration is the same, but you have additional options:
- Post-build upload mode: Set
useRunAfterProductionCompileHook: trueto upload after build (requires Next.js 15.4.1+) - Advanced plugin options: Use
webpack.unstable_sentryWebpackPluginOptionsto pass options to the Sentry Webpack Plugin
See Webpack Setup for complete Webpack configuration.
If stack traces show minified code, check that SENTRY_AUTH_TOKEN is set in your CI environment.
See Troubleshooting Source Maps for detailed debugging steps.
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").