Upload JavaScript sourcemaps so FastStats can show readable stack traces.
FastStats can turn minified browser stack traces back into the original file,
line and column when you upload the sourcemaps from the same build.
The easiest way to do this is with @faststats/sourcemap-uploader-plugin. The
plugin runs during your production build, uploads every .map file it finds and
adds the build ID to your JavaScript bundle. The FastStats web SDK reads that
build ID when it reports an error, so FastStats can choose the matching
sourcemap.
Turn on sourcemap output in your bundler, then add the FastStats plugin. The
default upload endpoint is https://sourcemaps.faststats.dev/v0/upload, so most
projects only need to pass authToken.
Run the upload as part of the same CI job that builds and deploys your frontend.
Keep the upload key in your CI secrets.
name: Build
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
- run: npm ci
- run: npm run build
env:
FASTSTATS_SOURCEMAP_KEY: ${{ secrets.FASTSTATS_SOURCEMAP_KEY }}
If your public site does not need to serve sourcemaps, set
deleteAfterUpload: true. The plugin deletes local .map files only after a
successful upload.
Every upload has a buildId. The browser error reporter sends the same build ID
with each error, which is how FastStats finds the right sourcemap.
By default the plugin uses the current git commit hash. If git is not available,
it creates a random ID for that build. You can also set the ID yourself.