← Back to dashboard
sentrymonitoringfreshReader view (for NotebookLM)

Sentry Integration Guide

What is Sentry?

The real model

@sentry/nextjs 11.8.0: dataCollection: PRIVACY_BASELINE on every init, span streaming, logs on by default, AI integrations automatic on Node.

v11 is a behaviour change, not a rename: an unset dataCollection now ships bodies, cookies, genAI inputs/outputs and stackFrameVariables, so set userInfo:false, httpBodies:[], genAI:{inputs:false,outputs:false} and friends (Replay is governed separately by maskAllText/maskAllInputs/blockAllMedia). Transactions are gone. Spans stream, tags reach errors only (use setAttribute), and beforeSendTransaction is a no-op, so scrub in beforeSendSpan and drop with attribute-based ignoreSpans. enableLogs was removed because Sentry.logger.* just sends ($0.50/GB past 5 GB). vercelAIIntegration and anthropicAIIntegration are default with tracing on Node only; setConversationId groups chats. Source maps upload after a Turbopack build; sentry-cli 3.x dropped releases files, so use sourcemaps inject/upload. For Claude Code, add https://mcp.sentry.dev/mcp (OAuth). Default skills are inspect + seer, and triage is opt-in. Token auth uses the Sentry-Bearer header.

Five Sentry primitives

One SDK, one trace id; dataCollection decides what leaves your servers.

Text
███████╗███████╗███╗   ██╗████████╗██████╗ ██╗   ██╗
██╔════╝██╔════╝████╗  ██║╚══██╔══╝██╔══██╗╚██╗ ██╔╝
███████╗█████╗  ██╔██╗ ██║   ██║   ██████╔╝ ╚████╔╝
╚════██║██╔══╝  ██║╚██╗██║   ██║   ██╔══██╗  ╚██╔╝
███████║███████╗██║ ╚████║   ██║   ██║  ██║   ██║
╚══════╝╚══════╝╚═╝  ╚═══╝   ╚═╝   ╚═╝  ╚═╝   ╚═╝

Sentry Integration Guide

Focus: @sentry/nextjs 11.x on Next.js 16 (App Router), privacy-first dataCollection, source maps, logs, tracing + AI agent monitoring, Session Replay, cron monitors, and Claude Code triage through the official Sentry MCP server and Seer.

Overview

Sentry is codeAmani's monitoring standard: one SDK captures errors, spans, structured logs, metrics, session replays, cron check-ins, and AI (gen_ai) spans, all linked by trace. The hosted MCP server at https://mcp.sentry.dev/mcp lets Claude Code read issues/traces/logs, run Seer root-cause analysis, and (if you grant the skill) triage.

Pinned versions (verified 2026-10-20 via npm view / PyPI):

PackageVersionNotes
@sentry/nextjs11.8.0 (latest)v10 line: 10.76.2 (v10 dist-tag). Peer: next ^14 || ^15 || ^16. Node >=20.19.0. TypeScript >=5.0.4.
@sentry/cli3.8.03.0 removed releases files … / files … and API-key auth.
@sentry/mcp-server0.42.0Only for the stdio / self-hosted MCP transport.
sentry-sdk (Python)2.72.0 stable3.0.0a7 is alpha — 3.x also swaps send_default_pii for data_collection.
next16.4.2Next 16 renamed middleware.ts → proxy.ts.

Official Documentation


SDK v11 — what changed (read before copying any old snippet)

v10v11 (current)Action
sendDefaultPii: false (restrictive default)Removed. dataCollection — unset = collect everythingImport PRIVACY_BASELINE in every Sentry.init (leaving sendDefaultPii is now a type error)
enableLogs: trueRemoved. Logs send whenever you call Sentry.logger.* or add a log integrationDelete the flag; scrub with beforeSendLog
Transactions + beforeSendTransaction / ignoreTransactionsSpan streaming is default; transactions no longer existUse beforeSendSpan (StreamedSpanJSON: name, attributes) and ignoreSpans
Scope tags on transactionsTags reach errors only; spans/logs/metrics use attributesSentry.setAttribute(s) for span-searchable context
import { withSentryConfig } from "@sentry/nextjs"import { withSentryConfig } from "@sentry/nextjs/config"Update next.config.ts
AI SDK / Anthropic needed manual setupvercelAIIntegration, anthropicAIIntegration are default when tracing is on (server only)Set dataCollection.genAI to keep prompts out
captureMessage had no stackStack traces attached by default (attachStacktrace)Expect new issue groups after upgrade
inboundFiltersIntegrationEventFilters (export removed)Rename filters by integration name

traceLifecycle: "static" (or SENTRY_TRACE_LIFECYCLE=static on Node/Vercel Edge) temporarily restores transaction mode; Sentry says it will be removed in a future major.


Next.js 16 setup (@sentry/nextjs 11.x)

Bash
npm install @sentry/nextjs@^11.8.0
# or the wizard (creates the same files):  npx @sentry/wizard@latest -i nextjs

Files (project root, or src/):

FileRole
sentry.data-collection.tscodeAmani privacy baseline: the dataCollection object every init imports
instrumentation-client.tsBrowser init + onRouterTransitionStart + Session Replay
sentry.server.config.tsNode.js runtime init (beforeSend, beforeSendLog, beforeSendSpan)
sentry.edge.config.tsEdge runtime init
instrumentation.tsregister() loads server/edge config; onRequestError = Sentry.captureRequestError
app/global-error.tsxCaptures React render errors
next.config.tswithSentryConfig from @sentry/nextjs/config: source maps, tunnel, Vercel crons
proxy.tsNext 16 proxy (ex-middleware), must exclude the tunnel route

All of these live in examples/ and type-check against @sentry/nextjs@11.8.0 + next@16.4.2 under tsc --strict.

1. The privacy baseline (required)

TypeScript
// sentry.data-collection.ts
import type * as Sentry from "@sentry/nextjs";

type SentryInitOptions = NonNullable<Parameters<typeof Sentry.init>[0]>;
export type DataCollectionOptions = NonNullable<SentryInitOptions["dataCollection"]>;

export const EXTRA_DENY_TERMS = [
  "forwarded", "-ip", "remote-", "via", "-user", // Sentry's documented extras
  "phone", "msisdn", "email", "card",            // codeAmani payment data
] as const;

const deny = { deny: [...EXTRA_DENY_TERMS] };

export const PRIVACY_BASELINE = {
  userInfo: false,            // no auto IP/email/username (explicit setUser({ id }) still sends)
  cookies: false,
  httpHeaders: { request: deny, response: deny },
  httpBodies: [],             // never ship request/response bodies
  urlQueryParams: deny,
  graphQL: { document: false, variables: false },
  genAI: { inputs: false, outputs: false }, // keep tokens + latency, drop prompt text
  databaseQueryData: false,
  queues: false,
  stackFrameVariables: false, // locals hold phone numbers / PHI
  frameContextLines: 5,
} satisfies DataCollectionOptions;

The v11 defaults this overrides (from the migration guide): userInfo: true, cookies: true, request+response headers, all request/response bodies, genAI inputs+outputs, databaseQueryData: true, stackFrameVariables: true. Sentry's built-in key denylist (auth, token, secret, password, key, jwt, session, …) still applies on top, but it matches key names only: a phone number in a field called msisdn sails through unless you deny it. dataCollection does not govern Session Replay (see below).

2. Server, edge, client

TypeScript
// sentry.server.config.ts
import * as Sentry from "@sentry/nextjs";
import { PRIVACY_BASELINE } from "./sentry.data-collection";

const REDACT = /(254\d{9})|(sntrys_[\w-]+)|(Bearer\s+[\w.-]+)/gi;
const scrub = (value: string): string => value.replace(REDACT, "[redacted]");

Sentry.init({
  dsn: process.env.SENTRY_DSN,
  environment: process.env.VERCEL_ENV ?? process.env.NODE_ENV,
  dataCollection: PRIVACY_BASELINE,
  tracesSampleRate: process.env.NODE_ENV === "production" ? 0.1 : 1.0,
  ignoreSpans: [{ attributes: { "sentry.op": "http.server", "url.path": "/api/health" } }],
  beforeSend(event) {
    if (event.user) delete event.user.email;
    for (const ex of event.exception?.values ?? []) {
      if (ex.value) ex.value = scrub(ex.value);
    }
    if (event.message) event.message = scrub(event.message);
    return event;
  },
  beforeSendLog(log) {
    if (log.level === "debug" || log.level === "trace") return null;
    log.message = scrub(String(log.message));
    return log;
  },
  beforeSendSpan(span) {
    span.name = scrub(span.name);
    return span;
  },
});

sentry.edge.config.ts is the same minus the hooks (see examples/). The client:

TypeScript
// instrumentation-client.ts
import * as Sentry from "@sentry/nextjs";
import { PRIVACY_BASELINE } from "./sentry.data-collection";

Sentry.init({
  dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,
  environment: process.env.NEXT_PUBLIC_VERCEL_ENV ?? process.env.NODE_ENV,
  dataCollection: PRIVACY_BASELINE,
  tracesSampleRate: process.env.NODE_ENV === "production" ? 0.1 : 1.0,
  tracePropagationTargets: ["localhost", /^\/(?!\/)/],
  integrations: [
    Sentry.replayIntegration({
      maskAllText: true,
      maskAllInputs: true,
      blockAllMedia: true,
      block: ["[data-payment-form]"],
    }),
  ],
  replaysSessionSampleRate: 0,   // error-only replays
  replaysOnErrorSampleRate: 1.0,
});

export const onRouterTransitionStart = Sentry.captureRouterTransitionStart;
TypeScript
// instrumentation.ts
import * as Sentry from "@sentry/nextjs";

export async function register(): Promise<void> {
  if (process.env.NEXT_RUNTIME === "nodejs") await import("./sentry.server.config");
  if (process.env.NEXT_RUNTIME === "edge") await import("./sentry.edge.config");
}

export const onRequestError = Sentry.captureRequestError;

3. withSentryConfig + tunnel route

TypeScript
// next.config.ts
import type { NextConfig } from "next";
import { withSentryConfig } from "@sentry/nextjs/config"; // v11 subpath

const nextConfig: NextConfig = {};

export default withSentryConfig(nextConfig, {
  org: process.env.SENTRY_ORG,
  project: process.env.SENTRY_PROJECT,
  authToken: process.env.SENTRY_AUTH_TOKEN, // build env only
  widenClientFileUpload: true,
  sourcemaps: { deleteSourcemapsAfterUpload: true },
  tunnelRoute: "/monitoring",
  _experimental: { vercelCronsMonitoring: true },
  bundleSizeOptimizations: { excludeDebugStatements: true },
  silent: !process.env.CI,
});

Tunnel route: tunnelRoute proxies browser envelopes through your own origin so ad-blockers don't drop them (adds server load; doesn't work with self-hosted Sentry). Use a fixed string, not true (random per deploy). On Turbopack (Next 16 default) Sentry cannot auto-skip the tunnel inside your proxy, so exclude it in proxy.ts:

TypeScript
// proxy.ts (Next 16; was middleware.ts in Next 15)
export const config = {
  matcher: ["/((?!monitoring|_next/static|_next/image|favicon.ico).*)"],
};

Source maps

  • next build + SENTRY_AUTH_TOKEN in the build env = automatic upload. With Turbopack the upload runs after the build (@sentry/nextjs >=10.13.0, next >=15.4.1). Dev builds never upload.
  • sourcemaps.deleteSourcemapsAfterUpload defaults to true: client maps under .next/static/ are deleted after upload; server maps are kept (needed at runtime, not public). Use sourcemaps.filesToDeleteAfterUpload only for custom globs.
  • widenClientFileUpload: true fixes [native code]/unmapped frames from Next and dependency chunks (slower builds).
  • On Vercel you can instead install the Sentry Vercel integration, which injects the token and uploads during deploys.
  • sentry-cli 3.x: sentry-cli releases files <v> upload-sourcemaps no longer exists. For non-Next builds use debug IDs:
Bash
npx @sentry/cli@3 sourcemaps inject ./dist
npx @sentry/cli@3 sourcemaps upload --release "$VERSION" ./dist

Logs

Logs are on by default in v11, with no flag. Anything you send with Sentry.logger.* (or capture via consoleLoggingIntegration, pinoIntegration, createSentryWinstonTransport, createConsolaReporter) is billed per GB.

TypeScript
import * as Sentry from "@sentry/nextjs";

Sentry.logger.info("Checkout completed", { order_id: orderId, cart_value: 99.99 });
Sentry.logger.info(Sentry.logger.fmt`User ${userId} purchased ${productName}`);
Sentry.setAttributes({ user_tier: "pro" }); // shared by logs, metrics, spans

Prefer one wide event per operation over many thin logs. Never log raw M-Pesa or Stripe payloads; beforeSendLog (see server config) is the scrub/drop hook. If you add consoleLoggingIntegration, every console.* at the chosen levels ships to Sentry.


Tracing (span streaming)

  • tracesSampleRate: 0.1 in production, 1.0 in dev. Spans bill per span (5M/month included on every plan).
  • v11 streams spans in batches; span names are low-cardinality (GET /users/:id, SELECT "User", GET api.example.com) and legacy attributes were renamed (http.method → http.request.method, db.statement → db.query.text, …). Update dashboards and alerts that filter on old names or ops.
  • ignoreSpans / tracesSampler run at span start, so match on attributes (url.path, sentry.op), not names.
  • beforeSendSpan can modify but not drop; fields are name, attributes, attributes['sentry.op'], end_timestamp, status: 'ok' | 'error'.
TypeScript
await Sentry.startSpan({ name: "stripe.checkout.create", op: "http.client" }, async () =>
  stripe.checkout.sessions.create(params),
);

Server Actions: wrap with Sentry.withServerActionInstrumentation("name", { headers: await headers() }, fn). Don't pass formData / recordResponse: true unless you have scrubbed them, because they attach user input to the event.

AI / agent monitoring (AI SDK + Anthropic)

As of SDK 11.0.0 the AI integrations are default whenever tracing is enabled, with no wrapper and no experimental_telemetry flag:

IntegrationLibraryVersionsInstrumented calls
vercelAIIntegrationai>=3.0.0 <=7generateText, streamText, embed, embedMany, rerank, ToolLoopAgent.generate/stream, experimental_decide (SDK ≥11.7.0 + AI SDK ≥7.0.128); generateObject/streamObject only on AI SDK ≤6
anthropicAIIntegration@anthropic-ai/sdk>=0.19.2 <1.0.0messages.create, messages.stream, beta.messages.create, legacy completions.create

Also default: OpenAI, Google Gen AI, LangChain, LangGraph, Mistral, Groq, Together AI.

Rules:

  • Node runtime only. Edge isn't instrumented (no diagnostics channels); the browser SDK no longer ships AI integrations at all.
  • Don't also call the AI SDK v7 registerTelemetry API, or you get duplicate spans.
  • dataCollection.genAI: { inputs: false, outputs: false } (our baseline) keeps model, token counts, latency and errors but drops prompt/completion text. Per-integration recordInputs / recordOutputs override it.
  • Sentry.setConversationId(id) groups multi-turn chats in Conversations; call Sentry.setUser({ id }) (internal id only) to fill the User column.

See examples/app/api/chat/route.ts.

Session Replay privacy

Replay is not controlled by dataCollection. Defaults mask all text (maskAllText), all inputs (maskAllInputs) and block all media (blockAllMedia). codeAmani rules:

  • Keep all three true explicitly in code; never set maskAllText: false on any app with user data (DoseVault / HIPAA: don't enable Replay at all).
  • Mark sensitive regions with data-sentry-mask / data-sentry-block / data-sentry-ignore (or the sentry-* classes) in shared components.
  • unblock / unmask take precedence over blocking, so avoid them.
  • Error-only sampling (replaysSessionSampleRate: 0, replaysOnErrorSampleRate: 1.0): only 50 replays/month are included.

Cron monitors

TypeScript
await Sentry.withMonitor("nightly-payment-reconcile", reconcilePayments, {
  schedule: { type: "crontab", value: "0 3 * * *" },
  checkinMargin: 5,
  maxRuntime: 10,
  timezone: "America/New_York",
});
  • withMonitor upserts the monitor on first check-in; captureCheckIn gives manual in_progress → ok/error (or one-shot heartbeat).
  • Vercel Cron Jobs: _experimental.vercelCronsMonitoring: true in withSentryConfig auto-creates monitors from vercel.json (works with Turbopack and App Router; the older webpack.automaticVercelMonitors is Webpack + Pages Router only).
  • Crons work in Server and Edge runtimes only. One cron monitor is included; extra monitors are $0.78/month each (PAYG).

MCP Server (Claude Code)

Bash
# Remote, OAuth (recommended)
claude mcp add --transport http sentry https://mcp.sentry.dev/mcp

# Scoped to one org / project (hides find_organizations / find_projects)
claude mcp add --transport http sentry https://mcp.sentry.dev/mcp/{organizationSlug}/{projectSlug}

Run /mcp to finish OAuth if the browser flow doesn't open. Sentry also publishes a Claude Code plugin with a sentry-mcp subagent: claude plugin marketplace add getsentry/sentry-mcp then claude plugin install sentry-mcp@sentry-mcp.

Token header (changed): to bypass OAuth with a user auth token, send Authorization: Sentry-Bearer <token>. Plain Bearer is reserved for the MCP's own OAuth tokens and will fail.

JSON
{
  "mcpServers": {
    "sentry": {
      "type": "http",
      "url": "https://mcp.sentry.dev/mcp?skills=inspect,seer",
      "headers": { "Authorization": "Sentry-Bearer ${SENTRY_ACCESS_TOKEN}" }
    }
  }
}

Skills (permission bundles)

SkillDefaultGrants
inspectonRead-only: issues, events, traces, logs, replays, releases, monitors, profiles, dashboards, docs
seeronanalyze_issue_with_seer (root cause + fix)
triageoffupdate_issue, add_issue_note, link_issue / unlink_issue
project-managementoffcreate/update projects, teams, DSNs, uptime/metric monitors, alert rules
docsoffDeprecated (docs tools now live in inspect)

Narrow with ?skills=inspect,triage or ?disable-skills=seer on the URL, or MCP_SKILLS / MCP_DISABLE_SKILLS for stdio. codeAmani default: inspect + seer; add triage only for a deliberate triage session.

Most-used tools: get_sentry_resource (paste any Sentry URL), get_issue_details, search_issues, search_errors, search_traces, search_logs, search_events, get_trace_details, get_span_details, get_event_stacktrace, get_issue_breadcrumbs, search_ai_conversations, analyze_issue_with_seer, find_monitors, get_replay_details, whoami. About 75 tools in total; the full catalog is discoverable via search_sentry_tools / execute_sentry_tool.

Stdio / self-hosted: npx @sentry/mcp-server@latest --access-token=<token> [--host=sentry.example.com]. Its AI-powered search tools need an LLM provider (EMBEDDED_AGENT_PROVIDER = anthropic, openai, azure-openai, or openrouter plus that provider's key).

Seer (AI debugging)

  • Autofix: root-cause analysis on incoming issues, then a PR (Seer GitHub/GitLab app) or handoff to Claude Code, Cursor Cloud Agents, or GitHub Copilot.
  • Seer Agent (open beta): natural-language investigation in Sentry or Slack; can archive issues and create dashboards, monitors, alerts.
  • Code Review: bug prediction on GitHub / GitLab.com PRs.
  • Needs the GitHub or GitLab (cloud) integration. Sentry states it does not train generative models on your data. Org toggle: Show Generative AI Features; block PR creation under Seer → Advanced.
  • Price: $40 per active contributor per month (anyone with 2+ PRs/MRs that month in a Seer-enabled repo; GitHub [bot] accounts excluded). Billed separately from PAYG. Legacy $20/month + credits pricing ended January 2026.

Pricing & quotas (2026-10-20, sentry.io/pricing + docs.sentry.io/pricing)

PlanPriceUsersErrorsSpansReplaysLogsMetricsCrons / UptimeRetention
DeveloperFree15k5M505 GB5 GB1 / 130 days
Team$26/mo (annual, default prepaid)Unlimited50k5M505 GB5 GB1 / 1up to 90 days
Business$80/mo (annual)Unlimited50k5M505 GB5 GB1 / 1up to 90 days + sampled

Overage (Team PAYG): errors from $0.0003625/event (>50k–100k), spans $0.000002/span (>5M–100M), replays $0.00375 (>50–5k), logs and metrics $0.50/GB, cron monitor $0.78, uptime monitor $1.00, continuous profiling $0.0315/hour, UI profiling $0.25/hour, attachments $0.3125/GB over 1 GB. Data past reserved volume + PAYG budget is dropped, not billed. Source maps and releases are free.


Python (sentry-sdk)

Stable is 2.72.0: send_default_pii still exists and defaults to off. Do not set it to True. data_collection is available on 2.x as opt-in, but passing it opts you into its permissive defaults for every key you don't set. 3.0 (alpha 3.0.0a7) removes send_default_pii, makes data_collection always-on, streams spans, and stops scrubbing stack locals by default. When you move to 3.x, set the full baseline:

Python
import os

import sentry_sdk

DENY = {"mode": "denylist", "terms": ["forwarded", "-ip", "remote-", "via", "-user", "phone", "msisdn", "email"]}

sentry_sdk.init(
    dsn=os.environ["SENTRY_DSN"],
    traces_sample_rate=0.1,
    data_collection={
        "user_info": False,
        "http_bodies": [],
        "graphql": {"document": False, "variables": False},
        "gen_ai": {"inputs": False, "outputs": False},
        "mcp": {"inputs": False, "outputs": False},
        "database_query_data": False,
        "queues": False,
        "stack_frame_variables": {"mode": "denylist"},
        "http_headers": {"request": DENY},
        "cookies": DENY,
        "url_query_params": DENY,
    },
)

CLI (sentry-cli 3.x)

Bash
npm install -g @sentry/cli@^3.8.0      # or: npx @sentry/cli@3 <cmd>
sentry-cli login                        # auth tokens only (API keys removed in 3.0)
sentry-cli info                         # verify auth + org

sentry-cli releases new "$VERSION"
sentry-cli releases set-commits "$VERSION" --auto
sentry-cli sourcemaps inject ./dist
sentry-cli sourcemaps upload --release "$VERSION" ./dist
sentry-cli releases finalize "$VERSION"
sentry-cli deploys new --release "$VERSION" -e production

sentry-cli issues list -p my-project -s unresolved
sentry-cli monitors list

sentry-cli releases deploys … is now the top-level sentry-cli deploys …. For Next.js apps withSentryConfig already creates + finalizes the release and uploads maps, so only use the CLI for other build targets. Sentry also ships a separate natural-language CLI for agents at https://cli.sentry.dev (not covered here).


Environment Variables

Secrets (store in the vault / Vercel env, never in git):

Bash
SENTRY_AUTH_TOKEN=sntrys_...

Non-secret settings:

VariableWhereValue
NEXT_PUBLIC_SENTRY_DSNclient bundleProject DSN (public by design; it can only send events)
SENTRY_DSNserver/edgeSame DSN
SENTRY_ORGbuildOrg slug, e.g. codeamani-labs
SENTRY_PROJECTbuildProject slug
SENTRY_TRACE_LIFECYCLEserver (optional)static only as a temporary escape hatch from span streaming

Token scopes: project:releases + org:read for source-map upload. For the MCP with Sentry-Bearer, a user token with org:read, project:read, event:read covers inspect; event:write adds triage.


Automation Workflows

Claude Code slash command: debug a Sentry issue

.claude/commands/sentry.md:

Markdown
Investigate the Sentry issue: $ARGUMENTS

1. `get_sentry_resource` (or `get_issue_details`) on $ARGUMENTS for the stack trace, tags, user count
2. `analyze_issue_with_seer` for Seer's root cause
3. `search_logs` / `get_trace_details` around the event for context
4. Read the relevant source files and propose a fix as a diff
5. State blast radius (users, events, first/last seen); only call `update_issue` if the triage skill is enabled and I confirm

GitHub Actions: release + source maps for a non-Next build

YAML
# .github/workflows/sentry-release.yml
name: Sentry Release
on:
  push:
    tags: ['v*']

jobs:
  release:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with: { fetch-depth: 0 }
      - uses: actions/setup-node@v4
        with: { node-version: '22' }
      - run: npm ci && npm run build
      - name: Create Sentry release
        env:
          SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
          SENTRY_ORG: ${{ vars.SENTRY_ORG }}
          SENTRY_PROJECT: ${{ vars.SENTRY_PROJECT }}
        run: |
          npx @sentry/cli@3 releases new ${{ github.ref_name }}
          npx @sentry/cli@3 releases set-commits ${{ github.ref_name }} --auto
          npx @sentry/cli@3 sourcemaps inject ./dist
          npx @sentry/cli@3 sourcemaps upload --release ${{ github.ref_name }} ./dist
          npx @sentry/cli@3 releases finalize ${{ github.ref_name }}
          npx @sentry/cli@3 deploys new --release ${{ github.ref_name }} -e production

Pin third-party Actions to a full commit SHA in real repos (see supply-chain/).


codeAmani notes

  • Standard: every codeAmani Next.js app ships @sentry/nextjs 11.x with the sentry.data-collection.ts baseline. A PR that adds Sentry.init without dataCollection is a review blocker (v11 would collect everything).
  • Server-side secrets: SENTRY_AUTH_TOKEN is build-time only (Vercel env / CI secret), never NEXT_PUBLIC_*. The DSN is public by design.
  • Payments: Stripe is the default rail; Stripe objects stay out because bodies are never collected (httpBodies: []). For Kenya-targeted projects using M-Pesa, the 254XXXXXXXXX redaction regex and msisdn/phone deny terms are mandatory, and callback handlers log CheckoutRequestID only, never the payload.
  • AI routing: Claude (primary) and AI SDK calls are traced automatically; keep genAI inputs/outputs off unless a project explicitly opts in for eval/debugging and the data is non-sensitive. Use setConversationId for chat products.
  • Health data (DoseVault / HIPAA): no Session Replay, no genAI content, no stack locals, no userInfo; Sentry needs a BAA before any PHI could reach it, so the default is to keep PHI out entirely.
  • African-market apps: the browser SDK + Replay add bundle weight; on 2G/3G-first apps skip Replay and use bundleSizeOptimizations.excludeDebugStatements (and excludeTracing if you don't trace the client).
  • Tunnel: codeAmani uses tunnelRoute: "/monitoring" and excludes it in proxy.ts.
  • MCP: default grant is inspect + seer. triage / project-management only for an explicit, human-confirmed session.
  • Webhooks from Sentry (issue alerts → internal tools): verify the Sentry-Hook-Signature header (HMAC-SHA256 of the body with the integration's client secret) before processing. (Svix is for Clerk, not Sentry.)

Common Use Cases

Use caseApproach
Debug a production errorMCP get_sentry_resource + analyze_issue_with_seer
Triage new issuesMCP search_issues → (triage skill) update_issue
Performance investigationMCP search_traces / get_trace_details / get_span_details
AI cost / failure analysisMCP search_ai_conversations; Sentry → Agents dashboard
Missed scheduled jobCron monitor alert; MCP find_monitors / get_monitor_details
Source maps (Next.js)withSentryConfig + SENTRY_AUTH_TOKEN at build
Source maps (other)sentry-cli sourcemaps inject + sourcemaps upload

Troubleshooting

IssueFix
'sendDefaultPii' does not exist in type … after upgradingRemoved in v11. Delete it and pass PRIVACY_BASELINE as dataCollection
'enableLogs' does not existRemoved in v11. Logs are on when you call Sentry.logger.*
withSentryConfig not exportedImport from @sentry/nextjs/config
Tags missing on spans / dashboards brokev11 span streaming: use setAttribute; update op/name/attribute filters
beforeSendTransaction never runsTransactions are gone; use beforeSendSpan / ignoreSpans
No AI spansTracing off, call runs on Edge, or AI SDK registerTelemetry also on (duplicates)
Browser events missingAd-blocker: set tunnelRoute and exclude it from the proxy.ts matcher
Minified stack tracesSENTRY_AUTH_TOKEN missing in build env; try widenClientFileUpload
sentry-cli releases files unknown commandRemoved in CLI 3.0. Use sourcemaps upload
MCP 401 with tokenUse Authorization: Sentry-Bearer <token>, not Bearer
MCP has no update_issuetriage skill is off by default. Re-auth granting it
Seer unavailableNeeds Seer add-on + GitHub/GitLab cloud integration; not on self-hosted