sentry-install-auth
Install and configure Sentry SDK authentication. Use when setting up a new Sentry integration, configuring DSN, or initializing Sentry in your project. Trigger with phrases like "install sentry", "setup sentry", "sentry auth", "configure sentry DSN".
Install
mkdir -p .claude/skills/sentry-install-auth && curl -L -o skill.zip "https://mcp.directory/api/skills/download/9313" && unzip -o skill.zip -d .claude/skills/sentry-install-auth && rm skill.zipInstalls to .claude/skills/sentry-install-auth
About this skill
Sentry Install & Auth
Overview
Install the Sentry SDK, configure DSN-based authentication, and verify error tracking is operational. Covers Node.js (@sentry/node), browser (@sentry/browser), and Python (sentry-sdk) with environment-based configuration and auth token setup for CLI/CI workflows.
Prerequisites
- Node.js 18.19+ or 20.6+ (required for ESM support in Sentry SDK v8)
- Package manager: npm, pnpm, or pip
- Sentry account with a project created at https://sentry.io
- DSN from Project Settings > Client Keys (DSN)
- For CLI/CI: auth token from https://sentry.io/settings/auth-tokens/
Instructions
Step 1 — Install the SDK
Node.js / TypeScript:
npm install @sentry/node
# For profiling support (optional):
npm install @sentry/profiling-node
Browser / Framework-specific:
npm install @sentry/browser
# Or pick your framework:
npm install @sentry/react # React
npm install @sentry/nextjs # Next.js
npm install @sentry/vue # Vue
Python:
pip install sentry-sdk
Step 2 — Store the DSN securely
The DSN (Data Source Name) tells the SDK where to send events. It looks like https://<key>@<org>.ingest.sentry.io/<project-id>. Never hardcode it — use environment variables.
# .env (add this file to .gitignore)
SENTRY_DSN=https://[email protected]/0
SENTRY_ENVIRONMENT=development
SENTRY_RELEASE=1.0.0
For production, store the DSN in your secret manager (AWS Secrets Manager, GCP Secret Manager, Vault, etc.) and inject it at deploy time.
Step 3 — Initialize the SDK
Node.js (ESM) — create instrument.mjs at project root:
This file MUST be imported before any other modules. The --import flag ensures Sentry instruments HTTP, database, and framework integrations via monkey-patching at load time.
// instrument.mjs — import BEFORE your app code
import * as Sentry from '@sentry/node';
Sentry.init({
dsn: process.env.SENTRY_DSN,
environment: process.env.SENTRY_ENVIRONMENT || 'development',
release: process.env.SENTRY_RELEASE,
// Performance: 100% in dev, 10-20% in production
tracesSampleRate: process.env.NODE_ENV === 'production' ? 0.1 : 1.0,
// Debug mode — disable in production
debug: process.env.NODE_ENV !== 'production',
// Never send PII by default
sendDefaultPii: false,
integrations: [
// Built-in integrations (httpIntegration, expressIntegration)
// are auto-detected — no manual registration needed
],
});
Start your app with the --import flag:
node --import ./instrument.mjs app.mjs
Or in package.json:
{
"scripts": {
"start": "node --import ./instrument.mjs app.mjs"
}
}
Browser:
import * as Sentry from '@sentry/browser';
Sentry.init({
dsn: process.env.SENTRY_DSN, // injected at build time
environment: process.env.NODE_ENV,
release: process.env.SENTRY_RELEASE,
tracesSampleRate: 0.1,
replaysSessionSampleRate: 0.1,
replaysOnErrorSampleRate: 1.0,
integrations: [
Sentry.browserTracingIntegration(),
Sentry.replayIntegration(),
],
});
Python:
import os
import sentry_sdk
sentry_sdk.init(
dsn=os.environ.get("SENTRY_DSN"),
environment=os.environ.get("SENTRY_ENVIRONMENT", "development"),
release=os.environ.get("SENTRY_RELEASE"),
traces_sample_rate=0.1,
send_default_pii=False,
)
Step 4 — Verify the installation
Send a test event and confirm it appears in the Sentry dashboard:
Node.js:
import * as Sentry from '@sentry/node';
Sentry.captureMessage('Sentry SDK installed successfully', 'info');
// Ensure the event is flushed before process exits
await Sentry.flush(2000);
Python:
import sentry_sdk
sentry_sdk.capture_message("Sentry SDK installed successfully")
# Ensure the event is flushed
sentry_sdk.flush(timeout=2)
Check the Issues tab in your Sentry project within 30 seconds. If the message appears, authentication is working.
Step 5 — Set up auth token for CLI and CI
The DSN authenticates the SDK for sending events. For the Sentry CLI (source maps, releases, deploys), you need a separate auth token.
Generate one at https://sentry.io/settings/auth-tokens/ with scopes:
project:releases— create releases and upload source mapsorg:read— read organization data
# Install Sentry CLI
npm install -g @sentry/cli
# Set the token
export SENTRY_AUTH_TOKEN=sntrys_YOUR_TOKEN_HERE
# Verify auth works
sentry-cli info
In CI, store SENTRY_AUTH_TOKEN as a secret environment variable.
Output
- SDK package installed (
@sentry/node,@sentry/browser, orsentry-sdk) - DSN stored in environment variables (never committed to git)
instrument.mjscreated and loaded before app entry point (Node.js)- Sentry initialized with environment, release, and sample rates configured
- Test event visible in Sentry dashboard confirming DSN auth works
- Auth token configured for CLI/CI workflows (optional)
Error Handling
| Error | Cause | Solution |
|---|---|---|
Invalid Sentry Dsn | Malformed DSN string | Copy DSN exactly from Project Settings > Client Keys (DSN). Format: https://<key>@<org>.ingest.sentry.io/<project-id> |
| Events not appearing in dashboard | DSN env var not loaded | Verify with console.log(process.env.SENTRY_DSN) before Sentry.init(). Check .env is loaded (use dotenv or framework equivalent) |
| HTTP 401 Unauthorized | Invalid or revoked auth token | Regenerate token at https://sentry.io/settings/auth-tokens/. Verify with sentry-cli info |
| HTTP 429 Too Many Requests | Rate-limited by Sentry | Lower tracesSampleRate. Check quota at Settings > Subscription. Events are dropped, not queued |
Express is not instrumented | SDK initialized after Express import | Move import './instrument.mjs' to first line or use --import flag. SDK must load before any framework imports |
| HTTP 403 Forbidden | Auth token missing required scopes | Regenerate token with project:releases and org:read scopes |
ECONNREFUSED / network errors | Sentry ingest endpoint unreachable | Check https://status.sentry.io for outages. Verify firewall allows *.ingest.sentry.io on port 443 |
| ESM compatibility error | Node.js < 18.19 or < 20.6 | Upgrade Node.js. SDK v8 requires these minimum versions for ESM --import support |
Examples
Express.js with full error handler:
// instrument.mjs
import * as Sentry from '@sentry/node';
Sentry.init({
dsn: process.env.SENTRY_DSN,
environment: process.env.SENTRY_ENVIRONMENT || 'development',
tracesSampleRate: 0.2,
});
// app.mjs — start with: node --import ./instrument.mjs app.mjs
import * as Sentry from '@sentry/node';
import express from 'express';
const app = express();
app.get('/api/health', (req, res) => {
res.json({ status: 'ok' });
});
app.get('/api/debug-sentry', (req, res) => {
throw new Error('Sentry test error');
});
// Sentry error handler must be registered after all routes
Sentry.setupExpressErrorHandler(app);
// Fallback error handler
app.use((err, req, res, next) => {
res.status(500).json({ error: 'Internal server error' });
});
app.listen(3000, () => console.log('Server running on :3000'));
Python Flask:
import os
import sentry_sdk
from flask import Flask
sentry_sdk.init(
dsn=os.environ.get("SENTRY_DSN"),
environment=os.environ.get("SENTRY_ENVIRONMENT", "development"),
traces_sample_rate=0.2,
send_default_pii=False,
)
app = Flask(__name__)
@app.route("/api/health")
def health():
return {"status": "ok"}
@app.route("/api/debug-sentry")
def debug_sentry():
raise Exception("Sentry test error") # Automatically captured
Graceful shutdown with flush:
import * as Sentry from '@sentry/node';
process.on('SIGTERM', async () => {
console.log('Shutting down gracefully...');
await Sentry.flush(5000); // wait up to 5s for pending events
process.exit(0);
});
Resources
- Node.js Setup Guide
- Browser SDK Setup
- Python SDK Setup
- Configuration Options
- SDK Migration v7 to v8
- Auth Tokens
- Sentry Status Page
Next Steps
For configuring alerts and issue management, see sentry-alerts-config.
More by jeremylongshore
View all skills by jeremylongshore →You might also like
flutter-development
aj-geddes
Build beautiful cross-platform mobile apps with Flutter and Dart. Covers widgets, state management with Provider/BLoC, navigation, API integration, and material design.
drawio-diagrams-enhanced
jgtolentino
Create professional draw.io (diagrams.net) diagrams in XML format (.drawio files) with integrated PMP/PMBOK methodologies, extensive visual asset libraries, and industry-standard professional templates. Use this skill when users ask to create flowcharts, swimlane diagrams, cross-functional flowcharts, org charts, network diagrams, UML diagrams, BPMN, project management diagrams (WBS, Gantt, PERT, RACI), risk matrices, stakeholder maps, or any other visual diagram in draw.io format. This skill includes access to custom shape libraries for icons, clipart, and professional symbols.
ui-ux-pro-max
nextlevelbuilder
"UI/UX design intelligence. 50 styles, 21 palettes, 50 font pairings, 20 charts, 8 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient."
godot
bfollington
This skill should be used when working on Godot Engine projects. It provides specialized knowledge of Godot's file formats (.gd, .tscn, .tres), architecture patterns (component-based, signal-driven, resource-based), common pitfalls, validation tools, code templates, and CLI workflows. The `godot` command is available for running the game, validating scripts, importing resources, and exporting builds. Use this skill for tasks involving Godot game development, debugging scene/resource files, implementing game systems, or creating new Godot components.
nano-banana-pro
garg-aayush
Generate and edit images using Google's Nano Banana Pro (Gemini 3 Pro Image) API. Use when the user asks to generate, create, edit, modify, change, alter, or update images. Also use when user references an existing image file and asks to modify it in any way (e.g., "modify this image", "change the background", "replace X with Y"). Supports both text-to-image generation and image-to-image editing with configurable resolution (1K default, 2K, or 4K for high resolution). DO NOT read the image file first - use this skill directly with the --input-image parameter.
pdf-to-markdown
aliceisjustplaying
Convert entire PDF documents to clean, structured Markdown for full context loading. Use this skill when the user wants to extract ALL text from a PDF into context (not grep/search), when discussing or analyzing PDF content in full, when the user mentions "load the whole PDF", "bring the PDF into context", "read the entire PDF", or when partial extraction/grepping would miss important context. This is the preferred method for PDF text extraction over page-by-page or grep approaches.
Related MCP Servers
Browse all serversMCP Installer simplifies dynamic installation and configuration of additional MCP servers. Get started easily with MCP I
Pica is automated workflow software for business process automation, integrating actions across services via a unified i
Manage and secure Hellō authentication apps with Hellō Admin — create, configure, and monitor user authentication quickl
Fetch Jampp Reporting campaign metrics (spend, impressions, clicks, installs) across date ranges with automated authenti
Access Intercom data securely via a remote MCP server with authenticated connections for AI tools and live updates.
install.md — Step-by-step MCP server guides to install and configure coding agents and use your software fast.
Stay ahead of the MCP ecosystem
Get weekly updates on new skills and servers.