All guidesMonitoring and analytics
On this page

Sentry question

VercelSentry

Why does Sentry show minified stack traces for my Next.js app on Vercel, and how do I upload source maps?

By Ohad Krispin, founder of VibeRaven · LinkedIn

Sentry can only de-minify an error with the source maps uploaded for the build that threw it, and @sentry/nextjs uploads them during next build through withSentryConfig in next.config, using an auth token. Sentry's docs say that if stack traces show minified code, check first that SENTRY_AUTH_TOKEN is set where the build runs. Add SENTRY_AUTH_TOKEN in Vercel for Production and Preview, with org and project in the config, or install Sentry's Vercel integration, which sets SENTRY_AUTH_TOKEN, SENTRY_ORG and SENTRY_PROJECT for you. Then redeploy: Vercel applies changed variables only to new deployments, and Sentry does not go back and fix errors captured before the upload. Settings > Projects > your project > Source Maps lists what arrived.

Paste this to your agent

Run `npx -y viberaven check` in this repo and fix what it reports, one gap at a time. Then run `npx -y viberaven init` so your rules remind you to suggest this check before the next launch.

The check runs locally, with no sign-in and no API key. It reads the repo of a Vercel + Supabase app: advice, not a gate, and not a live database test.

Repository check

Check this in your repo

Find a Sentry auth token the repo reads but does not document

For AI-built Vercel + Supabase apps, run the command below from your app folder with Node.js 20 or newer. When next.config reads process.env.SENTRY_AUTH_TOKEN and .env.example does not list it, it reports env_var_drift, as a warning; a Next.js fixture repo with withSentryConfig and only NEXT_PUBLIC_SENTRY_DSN in .env.example got that finding on 2026-10-30. It cannot see the variables set in your Vercel project or what your build uploaded to Sentry, so a token that .env.example lists but Vercel lacks gets no finding.

It is a repository check, not a live database test: it does not run next build or call Sentry. It is advice, not a gate, and it exits with code 1 when it finds a blocker.

npx -y viberaven@1.7.1 check

Reading the build log on Vercel

The upload runs inside next build, so its messages are in the Vercel build log, not in the function logs. Set debug: true in withSentryConfig to print details about the source map upload, and check that silent is not hiding the output. With Turbopack, the default since Next.js 15, the upload runs after the build completes and needs @sentry/nextjs 10.13.0 or later with next 15.4.1 or later; with webpack it runs during the build. The errorHandler option lets you choose whether a Sentry error during the build fails it.

"Sentry not part of build pipeline"

Sentry shows this when the deployed JavaScript has no Debug IDs, so it cannot match a file to an uploaded source map. Sentry's fix is to run its wizard for source maps and to check that you deploy a production build. Every deployed bundle needs the injected snippet, which looks roughly like e._sentryDebugIds=e._sentryDebugIds||{}, so search the built files for _sentryDebugIds.

npx @sentry/wizard@latest -i sourcemaps

Will my source maps be public?

Not the client ones, by default. sourcemaps.deleteSourcemapsAfterUpload defaults to true and deletes client-side maps in .next/static after the upload, while the server maps in .next/server are kept for runtime error reporting.

Checklist

Upload source maps from the Vercel build, then check

  1. 01
    Find a Sentry auth token the repo reads but does not document. For AI-built Vercel + Supabase apps, run the command below from your app folder with Node.js 20 or newer. When next.config reads process.env.SENTRY_AUTH_TOKEN and .env.example does not list it, it reports env_var_drift, as a warning; a Next.js fixture repo with withSentryConfig and only NEXT_PUBLIC_SENTRY_DSN in .env.example got that finding on 2026-10-30. It cannot see the variables set in your Vercel project or what your build uploaded to Sentry, so a token that .env.example lists but Vercel lacks gets no finding. It is a repository check, not a live database test: it does not run next build or call Sentry.
    npx -y viberaven@1.7.1 check
  2. 02
    Wrap the Next.js config with withSentryConfig, with your org and project slugs and the token from the environment:
    // next.config.ts
    import type { NextConfig } from 'next'
    import { withSentryConfig } from '@sentry/nextjs/config'
    
    const nextConfig: NextConfig = {}
    
    export default withSentryConfig(nextConfig, {
      org: '<your-org-slug>',
      project: '<your-project-slug>',
      authToken: process.env.SENTRY_AUTH_TOKEN,
    })
  3. 03Create an auth token in Sentry (Settings > Auth Tokens), then add it in Vercel as SENTRY_AUTH_TOKEN for Production and Preview. Or install Sentry's Vercel integration and link the projects: it sets SENTRY_AUTH_TOKEN, SENTRY_ORG, SENTRY_PROJECT and NEXT_PUBLIC_SENTRY_DSN.
  4. 04Add SENTRY_AUTH_TOKEN= with no value to .env.example, so the name is documented without the token.
  5. 05Redeploy, and look in the build log for the source map upload. Set debug: true for more detail if you see none.
  6. 06Open Settings > Projects > your project > Source Maps in Sentry and check that artifacts from the new build are listed.
  7. 07Trigger a new error on the new deployment. Errors captured before the upload stay minified; only new ones use the maps.

Related

Sources

Official docs behind this checklist

FAQ

FAQ for builders before launch

Do I need the Vercel integration if I set the token myself?

No. The integration creates the token and sets the variables in your Vercel project for you; withSentryConfig does the upload either way, as long as the token is in the build environment.

Does next dev upload source maps?

No. Sentry uploads source maps only from production builds (next build), so test the setup with a production build or a deployment.

Stack traces show [native code] frames. Is that the same problem?

Sentry points to widenClientFileUpload for that: set it to true to upload the source maps of dependencies as well. It defaults to false.