Skip to Content
OpenPerf

Reference

CLI

Create releases and upload source maps with the openperf command.

The openperf CLI ships with @openperf/sdk and runs on Node.js 24.11.1 or later. Use it in CI to register releases and upload browser source maps.

npx openperf releases create [--ref <commit>]
npx openperf sourcemaps upload <directory> [--url-prefix <prefix>]

Configuration

Every command needs four values. Pass them as environment variables (recommended in CI) or override any of them with a flag:

FlagEnvironment variableDescription
--url <url>OPENPERF_URLBase URL of your OpenPerf API (e.g. https://api.example.com).
--token <token>OPENPERF_AUTH_TOKENWrite-scoped API token starting with opt_.
--project <id>OPENPERF_PROJECTProject ID (the last segment of the project settings URL).
--release <version>OPENPERF_RELEASERelease version. Up to 200 characters, no spaces or slashes.

Commands

openperf releases create

Creates the release if it doesn't exist yet and links the project to it.

npx openperf releases create --ref "$(git rev-parse HEAD)"

Prop

Type

  • Idempotent: re-running keeps the release and updates its commit when --ref is provided.
  • Run once per project with the same --release to group multiple projects under one release.
  • Emits the release.created webhook event the first time a project is attached.

openperf sourcemaps upload

Scans a directory recursively and uploads every .map file for the release.

npx openperf sourcemaps upload dist --url-prefix "~/static"

Prop

Type

  • Relative paths (without .map) are appended to the prefix: assets/app.js.map matches ~/assets/app.js.
  • Re-uploading replaces the previous map for the same release.
  • Uploads are batched up to 500 files / 500 MB per request. Files over 50 MB are skipped and cause exit code 1.

Global flags & exit codes

  • -h, --help — prints usage and exits 0.
  • -v, --version — prints the installed @openperf/sdk version and exits 0.
  • Exits 0 on success; exits 1 on missing/invalid settings, empty directory, skipped oversized map, or API error (Error: <message> on stderr).

Common API errors

  • API_TOKEN_INVALID — token is wrong, revoked or expired.
  • API_TOKEN_NOT_ALLOWED — token is read-only and cannot write.
  • PROJECT_OUTSIDE_ORGANIZATION — project ID does not belong to the token's organization.
  • RELEASE_VERSION_CONFLICT — version already belongs to another release.
  • SOURCE_MAP_INVALID — uploaded .map file is not a valid source map.

On this page