ERR-004 recommended Setup

Source maps configured

Source maps generated, uploaded to Sentry via CI/CD, stack traces show original source

Question to ask

"What line of code caused last week's frontend error?"

Verification guide

Severity: Recommended

Without source maps, frontend stack traces show minified code (line 1, column 45678). Source maps translate back to original source.

Check automatically:

  1. Check for Sentry source map upload plugin:
# Build plugins for source map upload
grep -riE "@sentry/webpack-plugin|@sentry/vite-plugin|@sentry/esbuild-plugin|@sentry/rollup-plugin|@sentry/nextjs" package.json webpack.config.* vite.config.* rollup.config.* next.config.* 2>/dev/null
  1. Check for sentry-cli in build/deploy scripts:
# CLI-based source map upload
grep -riE "sentry-cli.*releases|sentry-cli.*sourcemaps|sourcemaps.*upload" package.json .github/workflows/*.yml 2>/dev/null
  1. Check for required auth tokens:
# Auth token for uploads
grep -riE "SENTRY_AUTH_TOKEN|SENTRY_ORG|SENTRY_PROJECT" .env.example .env* .github/workflows/*.yml 2>/dev/null
  1. Check build config generates source maps:
# Source map generation in build config
grep -riE "sourcemap.*true|devtool.*source-map|productionSourceMap" webpack.config.* vite.config.* next.config.* tsconfig.json 2>/dev/null

If not found in code, ask user:

  • "Are source maps uploaded to Sentry during builds?"
  • "Can you see original TypeScript/source code in Sentry stack traces?"
  • "Is source map upload part of the CI/CD pipeline?"

Cross-reference with:

  • ERR-003 (stack traces need source maps to be readable)
  • ERR-005 (releases tie source maps to deployments)

Pass criteria:

  • Source maps generated during build
  • Source maps uploaded to Sentry (via plugin or sentry-cli)
  • Upload happens in CI/CD pipeline (not manual)
  • Stack traces in Sentry show original source code

Fail criteria:

  • No source map upload configured
  • Stack traces show minified code (line 1, column 45678)
  • Source maps generated but not uploaded

Partial (acceptable):

  • Source maps uploaded for frontend only, backend is plain Node.js (readable without maps)
  • Upload exists but occasionally fails - note and fix

Evidence to capture:

  • Source map upload method (plugin or CLI)
  • CI/CD step that uploads
  • Sample Sentry error showing readable source

Section

19. Error Reporting

Error Tracking & Reliability