Read production errors and issues from Sentry.
# Check token is set (does not print the value)
[ -n "$SENTRY_AUTH_TOKEN" ] && echo "SENTRY_AUTH_TOKEN: set" || echo "SENTRY_AUTH_TOKEN: MISSING"
echo "ORG=${SENTRY_ORG:-not set}"
echo "PROJECT=${SENTRY_PROJECT:-not set}"
If SENTRY_AUTH_TOKEN is missing:
project:read, event:read, org:readSENTRY_AUTH_TOKEN in your environmentSet optional defaults to avoid passing flags every time:
export SENTRY_ORG=your-org-slug
export SENTRY_PROJECT=your-project-slug
SKILL_DIR="$(python3 -c "import os; print(os.path.dirname(os.path.realpath('$0')))" 2>/dev/null || echo "$HOME/.claude/skills/sentry")"
SENTRY_API="$SKILL_DIR/scripts/sentry_api.py"
python3 "$SENTRY_API" list-issues \
--org "$SENTRY_ORG" \
--project "$SENTRY_PROJECT" \
--time-range 24h \
--environment prod \
--limit 20 \
--query "is:unresolved"
python3 "$SENTRY_API" issue-detail ISSUE_ID
python3 "$SENTRY_API" issue-events ISSUE_ID --limit 10
python3 "$SENTRY_API" event-detail \
--org "$SENTRY_ORG" \
--project "$SENTRY_PROJECT" \
EVENT_ID
Add --include-entries to include stack traces.
python3 "$SENTRY_API" list-issues \
--org "$SENTRY_ORG" \
--project "$SENTRY_PROJECT" \
--query "ABC-123" \
--limit 1
| Flag | Default | Description |
|---|---|---|
| ------ | --------- | ------------- |
--org | $SENTRY_ORG | Org slug |
--project | $SENTRY_PROJECT | Project slug |
--time-range | 24h | Stats period (e.g. 7d, 30d) |
--environment | prod | Environment filter |
--limit | 20 | Max results (max 50) |
--query | Sentry search query | |
--base-url | https://sentry.io | For self-hosted Sentry |
--no-redact | Disable PII redaction — avoid in shared/logged environments |
--include-entries only when you need them and trust the environment--no-redact disables PII redaction — avoid in shared or logged environmentsSENTRY_BASE_URL or use --base-url共 1 个版本