Errors

Source maps

Upload your build's source maps so minified browser errors show the original file, line and source — without publishing the maps.

A production bundle is minified, so a browser stack trace points at index-abc123.js:1:48211. With your source maps uploaded, Errorgap rewrites each frame to the original file, line and column and shows the surrounding source — and because grouping happens after that, the same error stays one group across deploys instead of starting a new one with every bundle hash.

How it works

Maps are uploaded per release, one per generated script. When a notice arrives with that release, frames in a script that has a map are resolved on the server. The maps never need to be served to browsers, so your original source stays private.

@errorgap/browser can also resolve frames itself from maps your site serves publicly; server-side maps do not need that, and frames the browser already resolved are left as they are.

Build hidden maps

Generate maps without the sourceMappingURL comment, and keep the .map files out of what you deploy to your web server:

// vite.config.ts
export default defineConfig({
  build: { sourcemap: "hidden" },
});

// webpack.config.js
module.exports = { devtool: "hidden-source-map" };

Maps should include sourcesContent (both defaults do) so Errorgap can show the source around each frame.

Upload at deploy

PUT each map to the project with the release and the script's path as it is served. The body is the map itself. Authenticate with the project's upload key (Project Settings → Upload key) — not the API key, which ships to browsers and can no longer upload maps after November 2, 2026. Keep the upload key in your CI secrets.

RELEASE=$(git rev-parse HEAD)
cd dist
for map in $(find . -name '*.map'); do
  file="/${map#./}"; file="${file%.map}"     # ./assets/index-abc.js.map → /assets/index-abc.js
  curl -sf -X PUT \
    -H "x-errorgap-upload-key: $ERRORGAP_UPLOAD_KEY" \
    --data-binary "@$map" \
    "https://errorgap.example.com/api/projects/your-project/sourcemaps?release=$RELEASE&file=$file"
done
find . -name '*.map' -delete                    # then deploy dist without them

Uploading the same file for the same release again replaces it, so a retried deploy is safe. The file is the path only — the host it is served from does not matter, so a CDN works the same way.

Set the release

The SDK must report the same release the maps were uploaded under:

Errorgap.init({
  endpoint, projectSlug, apiKey,
  release: import.meta.env.VITE_RELEASE,   // the value used for the upload
});

Limits and retention

  • Each map can be up to 25 MB.
  • Maps for the 10 most recent releases are kept per project; uploading a newer release removes the oldest.
  • Errors reported before their release's maps were uploaded keep their minified frames. Upload during the deploy, before traffic reaches the new build.