Source Maps
See your original source code in production stack traces.
When your app is deployed, the code running in production is minified — variable names are shortened, whitespace is removed, and everything is bundled into a few large files. This makes stack traces nearly impossible to read.
Source maps fix that. They let DeepTracer translate minified stack traces back to your original source code — the real file names, function names, and line numbers you wrote.
How it works
- During build — Your source map files (
.map) are uploaded to DeepTracer, tagged with a release ID - At runtime — When an error happens, the SDK sends it with the same release ID
- On the dashboard — DeepTracer matches the error's stack trace against your uploaded source maps and shows you the original code
Without source maps, a stack trace looks like this:
Error: Cannot read property 'id' of undefined
at a.js:1:28394
at n.js:1:9823With source maps, it becomes:
Error: Cannot read property 'id' of undefined
at getUser (src/lib/users.ts:42:12)
at handleRequest (src/app/api/users/route.ts:18:8)Much better.
Setup for Next.js
Wrap your Next.js config with withDeepTracer — source maps are uploaded automatically during next build:
import { withDeepTracer } from "@deeptracer/nextjs/config"
export default withDeepTracer({
// your existing Next.js config
})Source map upload is auto-enabled when any of these are true:
- You're deploying on Vercel (
VERCEL=1) - You're running in CI (
CI=true) - You explicitly opt in (
DEEPTRACER_UPLOAD_SOURCEMAPS=true)
Required environment variables
| Variable | Description |
|---|---|
DEEPTRACER_KEY | Your project API key |
DEEPTRACER_ENDPOINT | Ingestion endpoint URL |
DEEPTRACER_RELEASE | Release identifier (auto-detected on Vercel via VERCEL_GIT_COMMIT_SHA) |
On Vercel, the release identifier is detected automatically from VERCEL_GIT_COMMIT_SHA. You only need to set DEEPTRACER_KEY and DEEPTRACER_ENDPOINT.
Explicit configuration
You can also pass options directly instead of using environment variables:
export default withDeepTracer(
{ reactStrictMode: true },
{
uploadSourceMaps: true,
release: "v1.2.3",
endpoint: "https://ingest.deeptracer.dev",
apiKey: "dt_your_api_key",
deleteSourceMapsAfterUpload: true,
},
)How matching works
When an error arrives with a release field, DeepTracer:
- Parses the stack trace into individual frames (file, line, column)
- Looks up the matching
.mapfile using the release ID and filename - Tries progressively shorter paths to handle different serving URLs — so
_next/static/chunks/app.jsalso matcheschunks/app.jsandapp.js - Resolves each frame to the original source location
The key rule: the release ID on the error must match the release ID used when uploading. If they don't match, DeepTracer shows the raw minified stack trace instead.
Security
Source maps contain your original source code, so DeepTracer keeps them private:
- Blocked from browsers — The Next.js plugin adds a rewrite rule that returns 404 for any
*.maprequest - Private storage — Uploaded maps are stored in authenticated storage, only accessible by DeepTracer's backend
- Project isolation — Source maps are scoped to your project and can't be accessed by others
- Optional deletion — Set
deleteSourceMapsAfterUpload: trueto remove.mapfiles from your build output after upload
Your build never fails due to source map upload issues. If the upload fails (network error, missing credentials, etc.), a warning is logged and the build continues normally.
Troubleshooting
Source maps not resolving? Check these three things:
- Release matches — The
releasesent with errors must exactly match thereleaseused when uploading source maps - Upload succeeded — Look for
[@deeptracer/nextjs] Uploaded N source map(s)in your build logs - Error has a release — Errors without a
releasefield can't be resolved