Common Issues and Solutions
DSN Configuration Problems
| Symptom | Root Cause | Fix |
|---|---|---|
| "No DSN provided" in debug output | Env var name typo or not loaded | Verify process.env.SENTRY_DSN is set. Check .env file loading order |
| "Invalid Sentry Dsn" exception | Malformed DSN string | Re-copy from Project Settings > Client Keys. Format: https://<key>@<org>.ingest.sentry.io/<id> |
| SDK initializes but no events | DSN has trailing whitespace | Trim the value: dsn: process.env.SENTRY_DSN.trim() |
| Events go to wrong project | DSN copied from wrong project | Each project has a unique DSN. Verify in Project Settings |
Events Not Appearing
beforeSend Dropping Events
The most common cause of "silently missing" events. The function must return event or null on every code path.
// WRONG — undefined return drops event
beforeSend(event) {
if (event.exception) {
return event;
}
// Missing return = undefined = event dropped
}
// CORRECT
beforeSend(event) {
if (event.message?.includes('ResizeObserver')) return null;
return event;
}sampleRate Misconfiguration
sampleRate: 0— drops 100% of error eventssampleRate: 1.0— sends all errors (default, recommended)tracesSampleRate: 0— disables performance monitoring (OK if you only want errors)
Process Exit Before Flush
Applies to: CLI tools, cron jobs, AWS Lambda, Google Cloud Functions, Azure Functions.
await Sentry.flush(2000); // Always flush before exitsentry_sdk.flush(timeout=2)Source Map Failures
Diagnosis Command
sentry-cli sourcemaps explain --org "$SENTRY_ORG" --project "$SENTRY_PROJECT" EVENT_IDCommon Mismatches
- Release mismatch —
Sentry.init({ release })must matchsentry-cli releases new - URL prefix mismatch —
--url-prefixmust match the browser URL path - Upload timing — source maps must be uploaded BEFORE the release goes live
- Missing source maps — verify build generates
.mapfiles
Import Order Issues
Sentry SDK v8 uses Node.js module hooks. It must be imported before any other module.
node --import ./instrument.mjs app.mjsRate Limiting (429)
sampleRate: 0.5, // 50% error sampling
tracesSampleRate: 0.01, // 1% transaction sampling
ignoreErrors: [...], // Filter known noiseServer-side: Settings > Projects > [Project] > Client Keys > Configure > Rate Limiting