CControxity Docs
GuidesReferenceHTTP APIOpen Controxity
Platforms

Expo web

An Expo or React Native web app: its browser errors relayed by your server, and its minified code read back with source maps.

What's different#

An Expo web build is minified and its files carry a build hash (entry-3f9c2a1b7d.js). Controxity handles both: it takes the hash out, so an error stays one problem across builds, and it reads the build's source maps, so the problem names your own file and line.

1. Send the browser's errors to your server#

Relay them as in Phone apps, with platform: "web". Send frames with their column, file:line:column:function: in minified code everything is on one line, so the column is what finds the place.

2. Use the same version everywhere#

Give the web build the version the server reports, for example the git commit, through EXPO_PUBLIC_BUILD. Then the errors from a build are matched with that build's maps, and Controxity knows which fixes it holds. See Name versions by commit.

3. Send the maps when you deploy#

After expo export -p web, send the .map files Expo wrote, with the same version:

node upload-maps.mjs "$COMMIT" dist/_expo/static/js/web/*.js.map
import { readFileSync } from "node:fs";
const [version, ...files] = process.argv.slice(2);
const maps = Object.fromEntries(files.map((f) => [f.replace(/^.*?(_expo\/)/, "$1").replace(/\.map$/, ""), readFileSync(f, "utf8")]));
const r = await fetch(`${process.env.CONTROXITY_URL}/api/v1/sourcemaps`, {
  method: "POST",
  headers: { authorization: `Bearer ${process.env.CONTROXITY_KEY}`, "content-type": "application/json" },
  body: JSON.stringify({ version, maps }),
});
console.log(await r.json());   // { saved: 21, refused: {} }

Expo writes "index maps" (in sections): Controxity takes them as they are. Don't put the maps on your website: Controxity keeps them and never serves them.

Controxity 1.132.0These pages are in the repository: docs/site