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 whenError.stackis accessed. For a bundled Node server, run it with this flag (or the equivalentNODE_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 buildtime 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