sentry-advanced-troubleshooting
Advanced Sentry troubleshooting for complex SDK issues, silent event drops, source map failures, distributed tracing gaps, and SDK conflicts. Use when events silently disappear, source maps fail to resolve, traces break across service boundaries, or the SDK conflicts with other libraries like OpenTelemetry or winston. Trigger with phrases like "sentry events missing", "sentry source maps broken", "sentry debug", "sentry not capturing errors", "sentry tracing gaps", "sentry memory leak", "sentry sdk conflict".
What this skill does
# Sentry Advanced Troubleshooting
## Overview
This skill addresses complex Sentry issues that go beyond basic setup: events that silently drop, source maps that refuse to resolve, distributed traces with gaps between services, SDK memory leaks, conflicts with other observability libraries, and network-level DSN blocking. Each section provides a systematic diagnosis path with concrete commands and code to identify root causes.
## Prerequisites
- Sentry SDK v8 installed and initialized (see `sentry-install-auth` skill)
- Access to application logs, Sentry dashboard, and project settings
- Sentry CLI installed (`npm install -g @sentry/cli`) for source map debugging
- Network diagnostic tools available (curl, dig)
- `debug: true` enabled in SDK init for verbose console output during troubleshooting
## Instructions
### Step 1 — Diagnose Silently Dropped Events
Events can vanish at multiple points between your code and the Sentry dashboard. Work through each layer systematically.
**Enable debug mode to see SDK internals:**
```typescript
import * as Sentry from '@sentry/node';
Sentry.init({
dsn: process.env.SENTRY_DSN,
debug: true, // Prints all SDK decisions to console
// Wrap transport to log every outbound envelope
transport: (options) => {
const transport = Sentry.makeNodeTransport(options);
return {
...transport,
send: async (envelope) => {
const [header, items] = envelope;
console.log('[Sentry Transport] Outbound envelope:', {
event_id: header.event_id,
sent_at: header.sent_at,
item_count: items?.length,
});
const result = await transport.send(envelope);
console.log('[Sentry Transport] Response:', result);
return result;
},
};
},
});
```
**Systematic event-drop diagnosis:**
```typescript
async function diagnoseEventDrop(): Promise<void> {
// Layer 1: Is the client alive?
const client = Sentry.getClient();
if (!client) {
console.error('FAIL: Sentry client is null — SDK never initialized');
console.error('Check: Is instrument.mjs loaded via --import flag?');
return;
}
// Layer 2: Is the DSN valid and reachable?
const dsn = client.getDsn();
if (!dsn) {
console.error('FAIL: DSN is null — check SENTRY_DSN env var');
return;
}
console.log('DSN:', `${dsn.protocol}://${dsn.host}/${dsn.projectId}`);
// Layer 3: Is beforeSend silently dropping events?
const opts = client.getOptions();
if (opts.beforeSend) {
console.warn('WARN: beforeSend is configured — it may be returning null');
console.warn('Test by temporarily removing beforeSend to isolate');
}
// Layer 4: Is sampling dropping events?
console.log('sampleRate:', opts.sampleRate ?? '1.0 (default)');
console.log('tracesSampleRate:', opts.tracesSampleRate ?? 'not set');
if (opts.sampleRate === 0) {
console.error('FAIL: sampleRate is 0 — ALL error events are dropped');
}
// Layer 5: Fire a test event and verify delivery
const eventId = Sentry.captureMessage('Diagnostic probe — safe to ignore', 'debug');
console.log('Test event ID:', eventId || 'NONE — event was dropped before send');
// Layer 6: Flush the transport buffer
const flushed = await Sentry.flush(10000);
console.log('Flush result:', flushed ? 'SUCCESS' : 'TIMEOUT — likely network issue');
if (!flushed) {
console.error('Events are queued but cannot reach Sentry — check network/proxy');
}
}
```
**Check for tunnel misconfiguration:**
If you route events through a server-side tunnel (to bypass ad blockers), verify the tunnel endpoint proxies correctly:
```bash
# Test your tunnel endpoint returns 200 and forwards to Sentry
curl -v -X POST "https://yourapp.com/api/sentry-tunnel" \
-H "Content-Type: application/x-sentry-envelope" \
-d '{"dsn":"https://[email protected]/123"}
{"type":"event"}
{"message":"tunnel test","level":"info"}' 2>&1 | grep "< HTTP"
# Expected: HTTP/2 200 (or 202)
```
### Step 2 — Debug Source Maps, Distributed Tracing, and Memory Leaks
**Source map resolution failures:**
Source maps break when the artifact URL stored in Sentry does not match the URL in the error's stack frame. Use `sentry-cli sourcemaps explain` to pinpoint the exact mismatch:
```bash
# List artifacts uploaded for the current release
RELEASE="${SENTRY_RELEASE:-$(node -e "console.log(require('./package.json').version)")}"
echo "Checking release: $RELEASE"
sentry-cli releases files "$RELEASE" list
# Explain why a specific event has unresolved source maps
# Get the event ID from the Sentry issue detail page
sentry-cli sourcemaps explain \
--org "$SENTRY_ORG" \
--project "$SENTRY_PROJECT" \
"EVENT_ID_HERE"
# Common output: "artifact ~/static/js/main.abc123.js not found"
# This means your url-prefix does not match the deployed URL path
```
**Validate before uploading:**
```bash
# Dry-run upload to catch issues before they affect production
sentry-cli sourcemaps upload \
--release="$RELEASE" \
--url-prefix="~/static/js" \
--validate \
--dry-run \
./dist
# If using a bundler plugin, verify it sets the correct prefix:
# Webpack: devtool: 'source-map' (not 'eval-source-map')
# Vite: build.sourcemap: true
```
**Check the URL matching rule:** The stack frame URL (e.g., `https://example.com/static/js/main.abc123.js`) must match the artifact URL (e.g., `~/static/js/main.abc123.js`) after the tilde prefix substitution. If your CDN rewrites paths, the prefix must account for the rewritten path.
**Distributed tracing gaps:**
When traces break between services (a parent service starts a trace but the downstream service creates a new unlinked trace), the issue is missing propagation headers:
```typescript
// Verify propagation headers are being sent
// In your HTTP client (axios, fetch, etc.), log outbound headers:
import * as Sentry from '@sentry/node';
// Check: does the active span exist when the outbound call happens?
const activeSpan = Sentry.getActiveSpan();
if (!activeSpan) {
console.error('No active span at the point of outbound HTTP call');
console.error('The call must happen INSIDE a Sentry.startSpan() callback');
}
// Manually propagate if auto-instrumentation is not working
const headers: Record<string, string> = {};
Sentry.getClient()?.getOptions().tracePropagationTargets; // check targets
console.log('tracePropagationTargets:',
Sentry.getClient()?.getOptions().tracePropagationTargets ?? 'default (all)');
// Verify: the downstream service must extract these headers
// sentry-trace: <traceId>-<spanId>-<sampled>
// baggage: sentry-environment=production,sentry-release=1.0.0,...
```
```typescript
// Fix: ensure tracePropagationTargets includes the downstream URL
Sentry.init({
dsn: process.env.SENTRY_DSN,
tracesSampleRate: 1.0,
// Only propagate to your own services — never to third-party APIs
tracePropagationTargets: [
'localhost',
/^https:\/\/api\.yourapp\.com/,
/^https:\/\/internal\./,
],
});
```
**Memory leak from unbounded breadcrumbs:**
The SDK stores breadcrumbs in memory. In long-running processes (workers, daemons), unbounded accumulation causes heap growth:
```typescript
// Diagnosis: check breadcrumb count over time
setInterval(() => {
const scope = Sentry.getCurrentScope();
// @ts-expect-error — accessing internal for diagnosis only
const breadcrumbs = scope._breadcrumbs?.length ?? 'unknown';
const mem = process.memoryUsage();
console.log('[Sentry Health]', {
breadcrumbs,
heapUsed: `${(mem.heapUsed / 1024 / 1024).toFixed(1)} MB`,
rss: `${(mem.rss / 1024 / 1024).toFixed(1)} MB`,
});
}, 60_000);
// Fix: cap breadcrumbs and disable noisy auto-breadcrumbs
Sentry.init({
dsn: process.env.SENTRY_DSN,
maxBreadcrumbs: 20, // Default is 100 — reduce for long-running processes
integrations: [
// Disable console breadcrumbs if they flood the buffer
Sentry.consoleIntegration({ levels: ['error', 'warn'] }),
],
});
```
### Step 3 — Resolve SDRelated in Backend & APIs
jfrog
IncludedInteract with the JFrog Platform via the JFrog CLI and REST/GraphQL APIs. Use this skill when the user wants to manage Artifactory repositories, upload or download artifacts, manage builds, configure permissions, manage users and groups, work with access tokens, configure JFrog CLI servers, search artifacts, manage properties, set up replication, manage JFrog Projects, run security audits or scans, look up CVE details, query exposures scan results from JFrog Advanced Security, manage release bundles and lifecycle operations, aggregate or export platform data, or perform any JFrog Platform administration task. Also use when the user mentions jf, jfrog, artifactory, xray, distribution, evidence, apptrust, onemodel, graphql, workers, mission control, curation, advanced security, exposures, or any JFrog product name.
cupynumeric-migration-readiness
IncludedPre-migration readiness assessor for porting NumPy to cuPyNumeric. Use BEFORE substantial porting work begins when the user asks whether code will scale on GPU, whether they should migrate to cuPyNumeric, which NumPy patterns transfer cleanly, what must be refactored before porting, or mentions pre-port assessment, scaling analysis, or refactor planning. Inspect the user's source code, look up NumPy usage, cross-reference the cuPyNumeric API support manifest, and distinguish distributed-scaling-friendly patterns from blockers such as unsupported APIs, scalar synchronization, host round-trips, Python/object-heavy control flow, shape/data-dependent branching, and in-place mutation hazards. Produce a verdict of READY, LIGHT REFACTOR, SIGNIFICANT REFACTOR, or NOT RECOMMENDED, with concrete refactor pointers.
alibabacloud-data-agent-skill
IncludedInvoke Alibaba Cloud Apsara Data Agent for Analytics via CLI to perform natural language-driven data analysis on enterprise databases. Data Agent for Analytics is an intelligent data analysis agent developed by Alibaba Cloud Database team for enterprise users. It automatically completes requirement analysis, data understanding, analysis insights, and report generation based on natural language descriptions. This tool supports: discovering data resources (instances/databases/tables) managed in DMS, initiating query or deep analysis sessions, real-time progress tracking, and retrieving analysis conclusions and generated reports. Use this Skill when users need to query databases, analyze data trends, generate data reports, ask questions in natural language, or mention "Data Agent", "data analysis", "database query", "SQL analysis", "data insights".
token-optimizer
IncludedReduce OpenClaw token usage and API costs through smart model routing, heartbeat optimization, budget tracking, and native 2026.2.15 features (session pruning, bootstrap size limits, cache TTL alignment). Use when token costs are high, API rate limits are being hit, or hosting multiple agents at scale. The 4 executable scripts (context_optimizer, model_router, heartbeat_optimizer, token_tracker) are local-only — no network requests, no subprocess calls, no system modifications. Reference files (PROVIDERS.md, config-patches.json) document optional multi-provider strategies that require external API keys and network access if you choose to use them. See SECURITY.md for full breakdown.
resend-cli
IncludedUse this skill when the task is specifically about operating Resend from an AI agent, terminal session, or CI job via the official resend CLI: installing/authenticating the CLI, sending/listing/updating/cancelling emails, batch sends, domains and DNS, webhooks and local listeners, inbound receiving, contacts, topics, segments, broadcasts, templates, API keys, profiles, or debugging Resend CLI/API failures. Trigger on mentions of Resend CLI, `resend`, `resend doctor`, `resend emails send`, `resend domains`, `resend webhooks listen`, `resend emails receiving`, or agent-friendly terminal automation.
alibabacloud-odps-maxframe-coding
IncludedUse this skill for MaxFrame SDK development and documentation navigation on Alibaba Cloud MaxCompute (ODPS). Helps answer MaxFrame API, concept, official example, and supported pandas API questions; create data processing programs; read/write MaxCompute tables; debug jobs (remote or local); and build custom DPE runtime images. Trigger when users mention MaxFrame, MaxCompute with MaxFrame, ODPS table processing, DPE runtime, MaxFrame docs/examples, DataFrame/Tensor operations, or GPU runtime setup. Works for both English and Chinese queries about Alibaba Cloud data processing with MaxFrame.