published fresh until

Node and Next.js source maps: find the real line of a prod error?

Summary As of October 2026, map the minified stack to source with source maps: generate maps at build time, run a bundled Node server with --enable-source-maps (it can add latency when Error.stack is read), and for browser code either enable Next.js productionBrowserSourceMaps, which serves your source, or upload maps privately to an error tracker.

Not for Sentry MCP setup, hydration errors

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

The problem

A production error report says at e (main.3f2a.js:1:48213). The code is minified into one line, so neither you nor your agent can say which function failed.

What the sources say

  • Node's CLI docs describe --enable-source-maps ("Enable Source Map support for stack traces", since v12.12.0, no longer experimental from v15.11.0 and v14.18.0). They warn that it can add latency when Error.stack is accessed. For a bundled Node server, run it with this flag (or the equivalent NODE_OPTIONS) and generate source maps at build time.
  • Next.js's productionBrowserSourceMaps says source maps are off for production browser bundles so your source is not leaked; the flag turns them on, writes maps beside the JS files and serves them, and increases next build time and memory.
  • A Stack Overflow question asks how to run a minified trace against a source map to get the original names; related questions cover webpack production builds. Error trackers can do the mapping for you if you upload maps privately instead of serving them.

How to describe it to your agent

Production errors show minified frames. Find our bundler and framework, generate source maps in the production build, and tell me whether they would be served publicly. For the Node server, add --enable-source-maps to the start command. Prefer uploading maps to the error tracker over serving them. Then resolve this trace using the map: <paste the frame list only, no user data>.

Mistakes to check

  • Turning on public browser source maps and shipping your source code unnoticed.
  • Generating maps but not matching them to the deployed build version.
  • Pasting traces that contain user data or tokens into a prompt.
  • Leaving the Node flag on for latency-sensitive code without measuring.

Limits

From Node and Next.js docs and one Stack Overflow question; I did not test the mapping. Other bundlers have their own source map settings.

Started from a post by @Node.js docs and Next.js docs, packaged by the editor. Original post

Subjects

More in agent workflows

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# Node and Next.js source maps: find the real line of a prod error?
Summary: As of October 2026, map the minified stack to source with source maps: generate maps at build time, run a bundled Node server with `--enable-source-maps` (it can add latency when `Error.stack` is read), and for browser code either enable Next.js `productionBrowserSourceMaps`, which serves your source, or upload maps privately to an error tracker.
Copy for agent
get the whatworks thread production-error-points-at-minified-line-1-get-real-file-and-line and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread production-error-points-at-minified-line-1-get-real-file-and-line
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks