GuidesSymbolication

Source Maps

Upload JavaScript source maps to Rustrak with sentry-cli or bundler plugins and get readable stack traces from minified production code.

Source maps turn a minified JavaScript stack trace back into your code: the real file, line, function name and source lines. Upload them when you build, and every error from that build shows readable frames.

Without source maps:

Error: Invoice not found
  ?  app:///_next/server/chunks/ssr/_0bwf~zv._.js:2:239718
  ?  app:///_next/server/chunks/ssr/apps_myapp_src_lib_actions_invoices_ts_09hq4k7._.js:2:5956

With them:

Error: Invoice not found
  getPostedInvoice  src/lib/actions/invoices.ts:84
  fetchInvoiceData  src/app/invoices/[id]/page.tsx:31

Rustrak takes uploads from the same tools as Sentry: the bundler plugins and sentry-cli. Hermes and Metro maps from React Native work too.

How a frame finds its map

Sentry’s tools give each built file and its map a shared debug ID. The SDK sends the debug IDs of the loaded files with every event (debug_meta), and Rustrak uses them to pick the right map for each frame. Matching is by debug ID only, so the files must go through Sentry’s plugin or sentry-cli sourcemaps inject before you deploy them.

Upload from your bundler

Turn on source maps in the build and add Sentry’s plugin, pointed at Rustrak.

// vite.config.js
import { defineConfig } from 'vite';
import { sentryVitePlugin } from '@sentry/vite-plugin';

export default defineConfig({
  build: { sourcemap: true },
  plugins: [
    sentryVitePlugin({
      org: 'anything',
      project: 'storefront',
      authToken: process.env.SENTRY_AUTH_TOKEN,
      url: 'https://rustrak.example.com',
    }),
  ],
});
JavaScript
// webpack.config.js
const { sentryWebpackPlugin } = require('@sentry/webpack-plugin');

module.exports = {
  devtool: 'source-map',
  plugins: [
    sentryWebpackPlugin({
      org: 'anything',
      project: 'storefront',
      authToken: process.env.SENTRY_AUTH_TOKEN,
      url: 'https://rustrak.example.com',
    }),
  ],
};
JavaScript

Framework SDKs wrap these plugins and call the server option sentryUrl instead of url: @sentry/nextjs, @sentry/sveltekit and others. With @sentry/sveltekit v10 the options sit at the root of sentrySvelteKit({ ... }); the older sourceMapsUploadOptions object is deprecated.

Uploads happen only in production builds (vite build), never in the dev server.

Upload with sentry-cli

For any other build, inject the debug IDs and upload the output folder:

export SENTRY_URL=https://rustrak.example.com
export SENTRY_AUTH_TOKEN=<api token>
export SENTRY_ORG=anything
export SENTRY_PROJECT=storefront

sentry-cli sourcemaps inject ./dist
sentry-cli sourcemaps upload ./dist
Shell

Deploy the injected files, not the ones from before inject.

The options

OptionEnv varWhat Rustrak does with it
url (sentryUrl)SENTRY_URLWhere the upload goes. Must be your Rustrak server
authTokenSENTRY_AUTH_TOKENAn API token from Settings → API Tokens
projectSENTRY_PROJECTThe project’s slug or numeric ID. Must exist
orgSENTRY_ORGIgnored. Any non-empty value

Rustrak has no organizations, and the DSN carries none. The option exists because the tools check that an organization exists before uploading; Rustrak answers that check for any name.

An explicit option wins over its environment variable.

The DSN does not decide where source maps go. It sends events. Without url, the plugin uploads to sentry.io. Without authToken, it skips the upload and the build still succeeds.

The upload runs during the build, so the token and URL must be there at build time. In Docker or CI, pass them to the build step: a variable set only on the running container comes too late.

Storage

Source maps are stored on disk under /data/sourcemaps, inside the /data volume from the installation, so they survive restarts and upgrades. To keep them elsewhere, mount a volume and point SOURCEMAP_STORAGE_PATH at it. The directory must be writable by the server.

Stack trace still minified?

  1. Does the build write .map files? build.sourcemap: true in Vite, devtool: 'source-map' in webpack.
  2. Did the upload run? The plugin logs it. No log at all usually means authToken is missing.
  3. Did it go to Rustrak? Without url, it went to sentry.io.
  4. 404 project not found at the end of the upload? project does not match a Rustrak project. The files go up first and are attached to the project last, so this fails only at the end, and the build still passes.
  5. Are the deployed files the injected ones? Each needs its //# debugId= comment.
  6. Is the error from a build after the upload? Maps apply to events from files with those debug IDs.

List what the server holds for a project:

curl -H "Authorization: Bearer $SENTRY_AUTH_TOKEN" \
  "$SENTRY_URL/api/0/projects/_/storefront/files/source-maps/"
Shell

Each entry shows a debug ID and whether it is a minified_source or a source_map. The server assembles an upload in the background, so a list taken right after the upload can be empty for a few seconds.

Esc

Type to search guides, configuration and the API.