Source Maps & Symbolication
why your stack trace says column 48215
Developer toolingdeveloper tooling / debugging
The frame you can't do anything with
Production error tracker, 40 users hit it:
TypeError: Cannot read properties of undefined (reading 'id')
at t (main.a3f9c1.js:1:48215)
at Object.n (main.a3f9c1.js:1:51902)
Line 1. Always line 1. Let's reason it out.
Clue 1: the line number is meaningless
Your minifier collapsed the whole bundle onto one line. So the column is the real address, not the line. Any tool that maps only line numbers is useless for bundled JS — remember that, it comes back at the end.
Clue 2: what a source map actually is
Not code. Not a runtime. Just a lookup table, shipped as JSON:
{
"version": 3,
"sources": ["src/cart.ts"],
"names": ["user", "id"],
"mappings": "AAAA,SAASC,GAAI...",
"sourcesContent": ["export function total(cart) {..."]
}
mappings is base64 VLQ, delta-encoded, 5 fields per segment: generated column, source index, original line, original column, name index. One entry per token. That's why maps are often bigger than the bundle.
Symbolication = (line, col) in → (file, line, col, name) out. You can do it yourself:
const { SourceMapConsumer } = require('source-map');
const raw = JSON.parse(fs.readFileSync('dist/main.a3f9c1.js.map', 'utf8'));
await SourceMapConsumer.with(raw, null, c =>
console.log(c.originalPositionFor({ line: 1, column: 48215 }))
);
// { source: 'src/cart.ts', line: 92, column: 18, name: 'user' }
Now at t becomes at getUserId (src/cart.ts:92). The pretty name came from names — without it you stay at t.
The three failures practitioners actually hit
- 404 on the map. The bundle still carries
//# sourceMappingURL=main.a3f9c1.js.map, but CI pruned.mapfiles from the deploy artifact. DevTools silently falls back to minified. Check:curl -Ithe map URL. - Release mismatch — the dangerous one. You uploaded maps for build 412; the running bundle is 413. Columns still resolve, so you get a confident, wrong file and line. Nobody notices for weeks. Fix: key uploads by the same release/commit the app reports, and let content-hashed filenames do the matching.
- Missing
sourcesContent. You getcart.ts:92but no snippet, because the tracker has no copy of your source.
Shipping them without leaking source
You usually want maps for your tracker, not for the public:
// webpack
devtool: 'hidden-source-map' // writes the .map, omits the URL comment
Generate, upload, then delete from the public bundle. And note the dev-mode trap tied to Clue 1: eval-cheap-module-source-map is fast because "cheap" means no column mappings — fine for stepping in dev, worthless for a one-line prod bundle.
Your exercise
Build your app for production. Find the sourceMappingURL comment in the output, then:
curl -Ithat map URL against your deployed site — 200 or 404?- Take any real minified frame and resolve it with the 4-line
source-mapsnippet above. - Now resolve the same frame using the map from a previous build. Does it error, or just hand you a plausible wrong line? That answer is why release matching matters.