Sentry Cli
Use Caution@iAhmadZain
npx machina-cli add skill @iAhmadZain/sentry-cli --openclawSentry CLI
Interact with Sentry.io for error monitoring, release management, and debug artifact uploads.
Installation
# macOS
brew install sentry-cli
# npm (cross-platform)
npm install -g @sentry/cli
# Direct download
curl -sL https://sentry.io/get-cli/ | bash
Authentication
# Interactive login (opens browser)
sentry-cli login
# Or set token directly
export SENTRY_AUTH_TOKEN="sntrys_..."
# Verify
sentry-cli info
Store tokens in .sentryclirc or environment:
[auth]
token=sntrys_...
[defaults]
org=my-org
project=my-project
Releases
Create & Finalize
# Create release (usually git SHA or version)
sentry-cli releases new "$VERSION"
# Associate commits (links errors to commits)
sentry-cli releases set-commits "$VERSION" --auto
# Finalize when deployed
sentry-cli releases finalize "$VERSION"
# One-liner for CI
sentry-cli releases new "$VERSION" --finalize
Deploys
# Mark release as deployed to an environment
sentry-cli releases deploys "$VERSION" new -e production
sentry-cli releases deploys "$VERSION" new -e staging
List Releases
sentry-cli releases list
sentry-cli releases info "$VERSION"
Source Maps
Upload source maps for JavaScript error deobfuscation:
# Upload all .js and .map files
sentry-cli sourcemaps upload ./dist --release="$VERSION"
# With URL prefix (match your deployed paths)
sentry-cli sourcemaps upload ./dist \
--release="$VERSION" \
--url-prefix="~/static/js"
# Validate before upload
sentry-cli sourcemaps explain ./dist/main.js.map
Inject Debug IDs (Recommended)
# Inject debug IDs into source files (modern approach)
sentry-cli sourcemaps inject ./dist
sentry-cli sourcemaps upload ./dist --release="$VERSION"
Debug Files (iOS/Android)
dSYMs (iOS)
# Upload dSYMs from Xcode archive
sentry-cli debug-files upload --include-sources path/to/dSYMs
# From derived data
sentry-cli debug-files upload ~/Library/Developer/Xcode/DerivedData/*/Build/Products/*/*.app.dSYM
ProGuard (Android)
sentry-cli upload-proguard mapping.txt --uuid="$UUID"
Check Debug Files
sentry-cli debug-files check path/to/file
sentry-cli debug-files list
Events & Issues
Send Test Event
sentry-cli send-event -m "Test error message"
sentry-cli send-event -m "Error" --logfile /var/log/app.log
Query Issues
# List unresolved issues
sentry-cli issues list
# Resolve an issue
sentry-cli issues resolve ISSUE_ID
# Mute/ignore
sentry-cli issues mute ISSUE_ID
Monitors (Cron)
# Wrap a cron job
sentry-cli monitors run my-cron-monitor -- /path/to/script.sh
# Manual check-ins
sentry-cli monitors check-in my-monitor --status ok
sentry-cli monitors check-in my-monitor --status error
CI/CD Integration
GitHub Actions
- name: Create Sentry Release
uses: getsentry/action-release@v1
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: my-org
SENTRY_PROJECT: my-project
with:
environment: production
sourcemaps: ./dist
Generic CI
export SENTRY_AUTH_TOKEN="$SENTRY_TOKEN"
export SENTRY_ORG="my-org"
export SENTRY_PROJECT="my-project"
VERSION=$(sentry-cli releases propose-version)
sentry-cli releases new "$VERSION" --finalize
sentry-cli releases set-commits "$VERSION" --auto
sentry-cli sourcemaps upload ./dist --release="$VERSION"
sentry-cli releases deploys "$VERSION" new -e production
Common Flags
| Flag | Description |
|---|---|
-o, --org | Organization slug |
-p, --project | Project slug |
--auth-token | Override auth token |
--log-level | debug/info/warn/error |
--quiet | Suppress output |
Troubleshooting
# Check configuration
sentry-cli info
# Debug upload issues
sentry-cli --log-level=debug sourcemaps upload ./dist
# Validate source map
sentry-cli sourcemaps explain ./dist/main.js.map
# Check connectivity
sentry-cli send-event -m "test" --log-level=debug
Overview
Sentry CLI lets you interact with Sentry.io from the command line for error monitoring, release management, and debug artifact uploads. It supports authentication, release workflows, deploy tracking, and handling source maps, dSYMs, and ProGuard mappings to keep errors tied to the correct code.
How This Skill Works
Install the CLI via brew, npm, or direct download, then authenticate with a token or via an interactive login. Use commands like releases new, releases set-commits, releases finalize, sourcemaps upload, and debug-files upload to create releases, attach artifacts, and link deployments to environments.
When to Use It
- You're creating a new release (Git SHA or version) and want to link commits to errors
- You need to upload JavaScript source maps to enable deobfuscation of errors
- You need to upload iOS dSYMs or Android ProGuard mappings for symbolication
- You are deploying a release and want to record deploy information in Sentry
- You want to test events or manage issues directly from the CLI
Quick Start
- Step 1: Install sentry-cli (brew install sentry-cli, npm install -g @sentry/cli, or curl)
- Step 2: Authenticate with sentry-cli login or export SENTRY_AUTH_TOKEN and configure .sentryclirc
- Step 3: Create a release and upload artifacts: sentry-cli releases new "$VERSION"; sentry-cli releases set-commits "$VERSION" --auto; sentry-cli releases finalize "$VERSION"; sentry-cli sourcemaps upload ./dist --release="$VERSION"
Best Practices
- Store the SENTRY_AUTH_TOKEN securely in .sentryclirc or environment variables and avoid hard-coding
- Validate source maps before uploading with sourcemaps explain to catch mismatches
- Use --url-prefix to match deployed asset paths to your source maps
- Inject debug IDs into source files before uploading with sourcemaps inject
- Automate releases in CI by combining releases new, --finalize, and sourcemaps upload
Example Use Cases
- CI pipeline: create a release, auto-link commits, finalize, and upload sourcemaps for production
- Upload all JS and .map files: sentry-cli sourcemaps upload ./dist --release="$VERSION" --url-prefix="~/static/js"
- Upload iOS dSYMs from Xcode archive: sentry-cli debug-files upload --include-sources path/to/dSYMs
- Send a test event to verify integration: sentry-cli send-event -m "Test error message"
- Mark a release deployed: sentry-cli releases deploys "$VERSION" new -e production