Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
c9b0435
feat: add send-event and send-envelope commands with DSN auth
BYK May 5, 2026
2986101
refactor: group send-event/send-envelope under 'sentry send' route
BYK May 5, 2026
ff6d2f8
fix: sort imports in app.ts + add missing send command docs fragment
BYK May 5, 2026
1a2b0e0
chore: regenerate docs
github-actions[bot] May 5, 2026
0ee9141
fix: address bot findings on PR #921
BYK May 5, 2026
33b1542
fix: remove false DSN auto-detect claim + reject Infinity timestamps
BYK May 5, 2026
9b18b4b
fix: address self-review blocking items before merge
BYK May 5, 2026
861377c
refactor: extract readFileBytes helper + wrap makeDsn and envelope cr…
BYK May 5, 2026
899b741
fix: wrap inline event createEventEnvelope/serializeEnvelope in try/c…
BYK May 5, 2026
efa96be
fix: validate DSN before file I/O in send-envelope
BYK May 5, 2026
97e27bc
fix: use 'sentry-cli' as client name, not 'sentry-cli/dev'
BYK May 5, 2026
caf3303
fix: wrap makeDsn in try/catch in buildEnvelopeUrl + fix generic erro…
BYK May 5, 2026
8d2aa22
fix: add explicit type annotation to avoid noImplicitAnyLet lint error
BYK May 5, 2026
54aa6f7
refactor: move send-event to event send, deprecate send-envelope
BYK May 6, 2026
61748cf
fix: update command-suggestions test to expect 'sentry event send'
BYK May 6, 2026
1e93022
fix: add skipRcUrlCheck to send-envelope deprecation shim
BYK May 6, 2026
562717a
fix: migrate to Node.js APIs and vitest after rebase
BYK Jun 2, 2026
95c39a9
feat: add --logfile and --with-categories flags to event send
BYK Jun 2, 2026
9720128
fix: use nullish coalescing for regex captures in logfile parser
BYK Jun 2, 2026
a4c810d
fix: reject whitespace-only --timestamp values
BYK Jun 2, 2026
57974e3
fix: replace return undefined with bare return (noUselessUndefined)
BYK Jun 2, 2026
6195f5a
fix: address self-review findings before merge
BYK Jun 2, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
140 changes: 85 additions & 55 deletions AGENTS.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/src/content/docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ cli/
│ │ ├── auth/ # login, logout, refresh, status, token, whoami
│ │ ├── cli/ # defaults, feedback, fix, import, setup, upgrade
│ │ ├── dashboard/ # list, view, create, add, edit, delete, revisions, restore
│ │ ├── event/ # view, list
│ │ ├── event/ # view, list, send
│ │ ├── issue/ # list, events, explain, plan, view, resolve, unresolve, archive, merge
│ │ ├── local/ # serve, run
│ │ ├── log/ # list, view
Expand Down
58 changes: 58 additions & 0 deletions docs/src/fragments/commands/event.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,57 @@



## Examples

### Sending Events

```bash
# Send an error event (default level)
sentry event send -m "Something went wrong"

# Specify level, release, and environment
sentry event send -m "Deploy check" -l info -r 1.0.0 -E production

# Add tags and extra data
sentry event send -m "Payment failed" --tag env:prod --tag region:us-east --extra amount:99.99

# Set user context
sentry event send -m "Login error" --user id:42 --user email:alice@example.com

# Custom fingerprint to group related events together
sentry event send -m "DB timeout" --fingerprint db-timeout --fingerprint {{ default }}
```

### Send from a JSON file

```bash
# Send a serialized Sentry Event object
sentry event send ./crash.json

# Send without re-parsing (raw mode — also supports pre-built envelopes)
sentry event send --raw ./crash.json
sentry event send --raw ./captured.envelope
```

### DSN authentication

`sentry event send` authenticates via a **DSN** rather than a user token.
No `sentry auth login` is required.

The DSN is resolved in priority order:

1. `--dsn <value>` flag (explicit)
2. `SENTRY_DSN` environment variable

```bash
# Explicit DSN
sentry event send -m "Test" --dsn "https://key@o123.ingest.us.sentry.io/456"

# Via environment variable
export SENTRY_DSN="https://key@o123.ingest.us.sentry.io/456"
sentry event send -m "Test"
```

### Listing Events

```bash
Expand Down Expand Up @@ -68,3 +118,11 @@ Event IDs can be found:
1. In the Sentry UI when viewing an issue's events
2. In the output of `sentry issue view` commands
3. In error reports sent to Sentry (as `event_id`)

## Backward compatibility

The old sentry-cli top-level command is available as a hidden alias:

```bash
sentry send-event # same as: sentry event send
```
3 changes: 2 additions & 1 deletion plugins/sentry-cli/skills/sentry-cli/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -323,10 +323,11 @@ Manage Sentry issues

### Event

View and list Sentry events
View, list, and send Sentry events

- `sentry event view <org/project/event-id...>` — View details of one or more events
- `sentry event list <issue>` — List events for an issue
- `sentry event send <args...>` — Send a Sentry event

→ Full flags and examples: `references/event.md`

Expand Down
62 changes: 60 additions & 2 deletions plugins/sentry-cli/skills/sentry-cli/references/event.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
---
name: sentry-cli-event
version: 0.36.0-dev.0
description: View and list Sentry events
description: View, list, and send Sentry events
requires:
bins: ["sentry"]
auth: true
---

# Event Commands

View and list Sentry events
View, list, and send Sentry events

### `sentry event view <org/project/event-id...>`

Expand Down Expand Up @@ -87,4 +87,62 @@ sentry event list PROJ-ABC -c prev
sentry event list PROJ-ABC --json
```

### `sentry event send <args...>`

Send a Sentry event

**Flags:**
- `--dsn <value> - DSN to send events to (overrides SENTRY_DSN env var)`
- `-m, --message <value>... - Event message (repeat for multi-line)`
- `-a, --message-arg <value>... - Arguments for message template (repeat for multiple)`
- `-l, --level <value> - Event severity level - (default: "error")`
- `-r, --release <value> - Release version`
- `-d, --dist <value> - Distribution identifier`
- `-E, --env <value> - Environment name (e.g. production, staging)`
- `-p, --platform <value> - Platform identifier (default: other)`
- `-t, --tag <value>... - Tag as KEY:VALUE (repeat for multiple)`
- `-e, --extra <value>... - Extra data as KEY:VALUE (repeat for multiple)`
- `-u, --user <value>... - User info as KEY:VALUE — id, email, username, ip_address, or custom`
- `-f, --fingerprint <value>... - Custom fingerprint part (repeat for multiple)`
- `--timestamp <value> - Event timestamp (Unix epoch, ISO 8601, or RFC 2822)`
- `--no-environ - Do not include environment variables in the event`
- `--logfile <value> - Path to a log file — last 100 lines are attached as breadcrumbs`
- `--with-categories - Parse 'CATEGORY: message' prefixes from logfile breadcrumbs`
- `--raw - Send file contents as-is without parsing`

**Examples:**

```bash
# Send an error event (default level)
sentry event send -m "Something went wrong"

# Specify level, release, and environment
sentry event send -m "Deploy check" -l info -r 1.0.0 -E production

# Add tags and extra data
sentry event send -m "Payment failed" --tag env:prod --tag region:us-east --extra amount:99.99

# Set user context
sentry event send -m "Login error" --user id:42 --user email:alice@example.com

# Custom fingerprint to group related events together
sentry event send -m "DB timeout" --fingerprint db-timeout --fingerprint {{ default }}

# Send a serialized Sentry Event object
sentry event send ./crash.json

# Send without re-parsing (raw mode — also supports pre-built envelopes)
sentry event send --raw ./crash.json
sentry event send --raw ./captured.envelope

# Explicit DSN
sentry event send -m "Test" --dsn "https://key@o123.ingest.us.sentry.io/456"

# Via environment variable
export SENTRY_DSN="https://key@o123.ingest.us.sentry.io/456"
sentry event send -m "Test"

sentry send-event # same as: sentry event send
```

All commands also support `--json`, `--fields`, `--help`, `--log-level`, and `--verbose` flags.
7 changes: 7 additions & 0 deletions src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ import { listCommand as replayListCommand } from "./commands/replay/list.js";
import { repoRoute } from "./commands/repo/index.js";
import { listCommand as repoListCommand } from "./commands/repo/list.js";
import { schemaCommand } from "./commands/schema.js";
import { sendEnvelopeCommand } from "./commands/send-envelope.js";
import { sendEventCommand } from "./commands/send-event.js";
import { sourcemapRoute } from "./commands/sourcemap/index.js";
import { spanRoute } from "./commands/span/index.js";
import { listCommand as spanListCommand } from "./commands/span/list.js";
Expand Down Expand Up @@ -107,6 +109,9 @@ export const routes = buildRouteMap({
local: localRoute,
api: apiCommand,
schema: schemaCommand,
// Backward-compat aliases for old sentry-cli — hidden from help
"send-event": sendEventCommand,
"send-envelope": sendEnvelopeCommand,
dashboards: dashboardListCommand,
issues: issueListCommand,
orgs: orgListCommand,
Expand Down Expand Up @@ -143,6 +148,8 @@ export const routes = buildRouteMap({
trials: true,
sourcemaps: true,
whoami: true,
"send-event": true,
"send-envelope": true,
},
},
});
Expand Down
9 changes: 6 additions & 3 deletions src/commands/event/index.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
import { buildRouteMap } from "../../lib/route-map.js";
import { listCommand } from "./list.js";
import { sendCommand } from "./send.js";

Check warning on line 3 in src/commands/event/index.ts

View check run for this annotation

@sentry/warden / warden: find-bugs

`sentry event send` includes full process.env in events by default

`buildEventFromFlags` unconditionally spreads `process.env` into the event's `extra.environ` field unless the user passes `--no-environ`. Since this command transmits the event to Sentry's ingest endpoint over the network, any secrets present in the shell environment (e.g. `AWS_SECRET_ACCESS_KEY`, `DATABASE_URL`, CI tokens) are leaked to the configured DSN's project on every invocation. This is opt-out rather than opt-in, and there is no scrubbing of common secret names client-side. Note: this preserves parity with the legacy `sentry-cli send-event` behavior, so it may be intentional, but the risk remains.
import { viewCommand } from "./view.js";

export const eventRoute = buildRouteMap({
routes: {
view: viewCommand,
list: listCommand,
send: sendCommand,
},
defaultCommand: "view",
docs: {
brief: "View and list Sentry events",
brief: "View, list, and send Sentry events",
fullDescription:
"View and list event data from Sentry.\n\n" +
"View, list, and send event data from Sentry.\n\n" +
"Use 'sentry event view <event-id>' to view a specific event.\n" +
"Use 'sentry event list <issue-id>' to list events for an issue.",
"Use 'sentry event list <issue-id>' to list events for an issue.\n" +
"Use 'sentry event send -m <message>' to send a test event.",
hideRoute: {},
},
});
Loading
Loading