Send source maps
Turn minified frames back into your own files and lines, so a problem names the real place and the fixer reads it.
When you need it#
When what runs is built from what you wrote: a minified web bundle, a Worker bundle, compiled TypeScript you can't run with --enable-source-maps. Without maps a problem says entry.js:1:23456; with them, src/garden.ts:42:walk.
Send them when you deploy#
The easiest way is one command in CI: node controxity.js release --maps dist (Releases from CI). Or call the API yourself:
POST /api/v1/sourcemaps, with the place's server key (not a browser key):
curl -X POST "$CONTROXITY_URL/api/v1/sourcemaps" \
-H "authorization: Bearer $CONTROXITY_KEY" -H "content-type: application/json" \
--data @- <<EOF
{"version": "$COMMIT", "maps": {"index.js": $(cat dist/index.js.map)}}
EOFconst maps = Object.fromEntries(files.map((f) => [nameInFrames(f), fs.readFileSync(f, "utf8")]));
await fetch(`${url}/api/v1/sourcemaps`, {
method: "POST",
headers: { authorization: `Bearer ${key}`, "content-type": "application/json" },
body: JSON.stringify({ version, maps }),
});version: the version the errors from that build carry. It finds the right maps for each error.maps: each map by the file's name as your frames give it (index.js,_expo/static/js/web/entry-3f9c2a1b7d.js). A map can be an object or its JSON text. Index maps (in sections, as Expo and Metro write them) work as they are.
Answer: {"saved": 21, "refused": {}}. Up to 200 MB per call. Each product keeps its newest 30 builds' maps.
Frames need their column#
In minified code everything is on one line, so send each frame as file:line:column:function. The SDKs do this already; send it yourself if you call the API directly.
What happens#
Each error is translated as it arrives: the frame becomes src/…:line:function, so the same error is one problem across builds and the fixer reads the right file. A bundle's hash is taken out of its name even without a map. The maps stay with Controxity and are never served to anyone.