Abrova
☰ Docs menu · Upload source maps (CLI)

Upload Source Maps with the CLI

Ship the `@abrova-trace/cli` from your CI/CD pipeline to upload sourcemaps after every build. Turns minified stack traces into readable source file paths in the Abrova Trace dashboard.

CLI 0.1.1Node.js 18+Last updated: 27 Oct 2026

The @abrova-trace/cli uploads sourcemaps from your CI/CD pipeline to Abrova Trace. Any error captured after the upload will be shown with real source file names and line numbers in the dashboard — no more minified 4d240bf7.js:1:16945 stacks.

When do you need this?

Anytime you ship a production build with minification (Next.js, Vite, webpack, Rollup). Without uploaded sourcemaps, every error in the Abrova Trace dashboard shows the minified stack — useless for debugging.

Prerequisites#

You need three things:

  • Node.js 18+ on the machine that runs the upload (your CI runner or local dev machine)
  • A personal access token with the sourcemaps:write scope
  • Your project DSN from Trace → Source maps & symbols in Abrova Console

Install the CLI#

The CLI comes from Abrova Center. Add the registry once, then install it as a dev dependency:

bash
# .npmrc (in your project root)
@abrova-trace:registry=https://center.abrova.ir/api/packages/abrova/npm/
bash
npm install --save-dev @abrova-trace/cli

Run it from your project with npx abrova-trace (for example npx abrova-trace --help). The command name is abrova-trace.

Create a Personal Access Token#

Personal Access Tokens (PATs) are user-scoped, long-lived credentials — the same pattern many developer CLIs use. They replace user session tokens for automated workflows.

  1. Open the Abrova Console: Account → Personal Access Tokens
  2. Click New Token
  3. Give it a name (e.g. CI upload — production)
  4. Enable the sourcemaps:write scope
  5. Choose an expiration (no expiration is fine for CI; 90 days is a common compromise)
  6. Click Create Token
  7. Copy the ab_pat_xxx value immediately — it will only be shown once

Store this in your CI environment as a secret named ABROVA_TRACE_TOKEN.

Token security.
  • Tokens are stored hashed on our side — we cannot recover a lost token, only revoke and reissue.
  • The token IS the credential — anyone with it can upload sourcemaps to any of your projects.
  • Revoke instantly from the same page if it leaks. All CLI/CI jobs using it stop working immediately.
  • Never commit tokens to git. Use your CI provider's secrets (GitHub Actions Secrets, GitLab CI variables, etc.).

Find Your Project ID#

The CLI's "project ID" is the project DSN of the web platform the maps belong to (each platform of an Abrova project has its own DSN).

  1. Open Abrova Console and select your project
  2. Go to Trace → Source maps & symbols (the Source maps tab)
  3. In the Upload from CI card, pick the web platform if your project has more than one, then copy Project DSN for the CLI

Store this as ABROVA_TRACE_PROJECT in your CI environment (the CLI also still reads the legacy ABROVA_TRACE_DSN variable).

Upload from CI#

Add these two lines to your build pipeline right after your production build creates the sourcemap files:

bash
export ABROVA_TRACE_TOKEN=ab_pat_xxx
export ABROVA_TRACE_PROJECT=<your-project-id>

npx abrova-trace sourcemaps upload ./path/to/your/sourcemaps \
  --release "1.2.3"

That's it. The CLI recursively finds every .map file under the given directory, uploads them all in a single request, and tags them with the release version so Abrova Trace can match them to errors from that version.

Example: Upload Next.js Source Maps#

For Next.js, enable sourcemap generation in next.config.js:

js
module.exports = {
  productionBrowserSourceMaps: true,
};

Then in your CI script:

bash
#!/bin/bash
set -e

# 1. Build with sourcemaps
npm run build

# 2. Copy sourcemaps into a dedicated folder
mkdir -p ./sourcemaps
find .next/static/chunks -name "*.js.map" -exec cp {} ./sourcemaps \;

# 3. Upload to Abrova Trace tagged with the release version
npx abrova-trace sourcemaps upload \
  --release "$NEXT_PUBLIC_APP_VERSION" \
  ./sourcemaps

# 4. Remove sourcemaps from the deployed build so browsers can't download them
#    (source stays private — Abrova keeps the maps server-side)
find .next/static/chunks -name "*.js.map" -delete
find .next/static/chunks -name "*.js" -exec \
  sed -i '/^\/\/# sourceMappingURL=/d' {} +

Match the Release Version#

The --release flag must match the version your SDK sends when reporting errors. If your Next.js SDK is initialised with:

typescript
AbrovaTrace.init({
  apiKey: process.env.NEXT_PUBLIC_ABROVA_TRACE_API_KEY!,
  release: process.env.NEXT_PUBLIC_APP_VERSION, // e.g. "1.2.3"
});

Then upload with:

bash
npx abrova-trace sourcemaps upload \
  --release "$NEXT_PUBLIC_APP_VERSION" \
  ./sourcemaps

If the release strings don't match, Abrova Trace won't find the sourcemap for the error and will fall back to showing the minified stack.

Common cause of unresolved stacks.

"I uploaded sourcemaps but errors still show minified stacks."

Usually the release string in the upload doesn't match what the SDK is sending. Check the Abrova Trace dashboard's error detail page for the release version, then re-upload with that exact string.

CLI Options#

--project <id>

Project DSN (or set ABROVA_TRACE_PROJECT env var). --dsn <id> is an alias

--release <version>

Required. Release version this bundle belongs to

--token <token>

Personal access token (or set ABROVA_TRACE_TOKEN env var)

--api-url <url>

Base URL of the Trace API (or set ABROVA_TRACE_API_URL env var). Default: https://trace.abrova.ir

--dry-run

Preview which files would be uploaded without sending them

A flag takes precedence over its environment variable. A project API key (ab_live_…) does not work here — the CLI needs a personal access token.

Self-Hosted Abrova Trace#

Coming soon. Self-hosted Abrova Trace is coming soon. See Self-Hosted.

When you run Abrova Trace on your own infrastructure, point the CLI at your API:

bash
export ABROVA_TRACE_API_URL=https://trace.mycompany.com

npx abrova-trace sourcemaps upload \
  --release "1.2.3" \
  ./sourcemaps

The CLI does exactly the same thing against a self-hosted instance — no code changes, just the URL.

Exit Codes#

  • 0 — success
  • 1 — any error (invalid token, network failure, upload rejected, etc.)

Suitable for gating a deploy on successful upload:

yaml
# .github/workflows/deploy.yml
- name: Upload sourcemaps
  run: npx abrova-trace sourcemaps upload --release "$GITHUB_SHA" ./sourcemaps
  env:
    ABROVA_TRACE_TOKEN: ${{ secrets.ABROVA_TRACE_TOKEN }}
    ABROVA_TRACE_PROJECT: ${{ secrets.ABROVA_TRACE_PROJECT }}

- name: Deploy
  run: ./deploy.sh
  # Deploy only runs if sourcemap upload succeeded

Upload Limits#

  • Max bundle size: 110 MB per upload (whole multipart request)
  • Max file size: 50 MB per individual .map file
  • Max files per upload: 500

These are generous defaults that fit typical Next.js, Vite, and webpack builds. Larger files are rejected with HTTP 413. If your bundle exceeds 110 MB, split it into several uploads with the same --release (for example one folder at a time), or contact us.

iOS dSYMs#

The CLI uploads JavaScript source maps only. iOS debug symbols (dSYMs) are uploaded in Abrova Console:

  1. In Xcode, open Organizer › Archives › Download Debug Symbols, then zip the .dSYM folder
  2. Open Trace → Source maps & symbols and choose the iOS dSYMs tab
  3. Pick the release and drop the .zip file (one .zip per upload, up to 10 MB)

Uploading needs the member role or higher; deleting uploaded files needs admin or owner — see Roles & Permissions.

Troubleshooting#

HTTP 401: Invalid token

Token missing, expired, revoked, or missing the sourcemaps:write scope. Create a new one at Account → Personal Access Tokens.

HTTP 404: Project not found

The project ID does not exist or your token owner does not have access to it. Copy it again from Trace → Source maps & symbols (Project DSN for the CLI).

HTTP 413: Content Too Large

Bundle exceeds 110 MB, or one .map file exceeds 50 MB. Split into smaller uploads or contact us.

Errors still show minified stacks

Release string mismatch. The --release value must match what your SDK sends. Check the error detail page in the dashboard.

No .map files found

Sourcemaps were not generated by the build. For Next.js, set productionBrowserSourceMaps: true in next.config.js.

Was this page helpful?
Report a problem