Documentation
Source maps and CLI
Upload your source maps from CI so errors show your original file and line, not minified JavaScript.
In production your JavaScript is minified: an error says index-3fa2.js:1:48211. If you upload the source maps for each release, Wutbug translates stack traces back to your original code (file, line and code snippet) in the dashboard and in responses from the MCP server.
How it works
- Your build generates
.mapfiles next to the.jsfiles. - In CI, the CLI uploads the
.mapfiles with a release identifier (--release). - Your app initializes the SDK with the same
release. - When a report arrives, Wutbug looks up the maps for that
releaseby the URL of each file in the stack trace.
1. Pass the release to the SDK
TypeScript
wutbug.init({
projectKey: 'pk_your_key',
endpoint: 'https://api.wutbug.dev',
release: import.meta.env.VITE_RELEASE, // for example the commit SHA
});With the script tag: data-release="…".
2. Generate the source maps
| Tool | Configuration |
|---|---|
| Vite | build: { sourcemap: 'hidden' } in vite.config.ts |
| Next.js | productionBrowserSourceMaps: true in next.config.ts |
| webpack | devtool: 'hidden-source-map' |
| esbuild | --sourcemap=external |
The hidden variants generate the .map files without the //# sourceMappingURL comment, so your source code isn't publicly exposed.
3. Upload the maps from CI
Create the project's secret key (sk_…) in the dashboard, under Projects → Source maps, and store it as a CI secret named WUTBUG_SECRET_KEY.
Terminal
npx @wutbug/cli sourcemaps upload ./dist/assets \
--release "$GITHUB_SHA" \
--url-prefix /assets/ \
--api https://api.wutbug.dev \
--delete| Option | Description |
|---|---|
<dir> | Folder to search for *.js.map files (recursive). |
--release <version> | Required. The same value you pass to init({ release }). |
--url-prefix <path> | URL path where <dir> is served. Defaults to /. Example: if dist/assets/index-3fa2.js is served at https://app.acme.com/assets/index-3fa2.js, use /assets/. |
--api <url> | API URL. Defaults to $WUTBUG_API_URL. |
--delete | Deletes the local .map files after uploading them, so they don't get published. |
| Environment variable | Description |
|---|---|
WUTBUG_SECRET_KEY | Required. The project's secret key (sk_…). |
WUTBUG_API_URL | API URL, if you don't use --api. |
Example with GitHub Actions and Vite
.github/workflows/deploy.yml
- name: Build
run: npm run build
env:
VITE_RELEASE: ${{ github.sha }}
- name: Upload source maps to Wutbug
run: npx @wutbug/cli sourcemaps upload ./dist/assets --release ${{ github.sha }} --url-prefix /assets/ --delete
env:
WUTBUG_SECRET_KEY: ${{ secrets.WUTBUG_SECRET_KEY }}
WUTBUG_API_URL: https://api.wutbug.devNext.js
Next.js client files are served under /_next/static/:
Terminal
npx @wutbug/cli sourcemaps upload .next/static --release "$GIT_SHA" --url-prefix /_next/static/ --deleteCommon problems
- The stack trace is still minified. Check that the report's
release(visible in the dashboard) is identical to the one you used when uploading, and that--url-prefixmatches the actual path of the files. - "Set WUTBUG_SECRET_KEY…": the variable is missing or doesn't start with
sk_. - The secret key leaked. Generate a new one in the dashboard: the old one stops working. We only store a hash of the key, so we can't show it to you again.