Error monitoring setup

From abcnuts/manus-skills · View interactive version

Error monitoring setup is an AI agent skill from the GitHub repository abcnuts/manus-skills. Automated Sentry and error tracking setup for production applications

How to use this skill

Skill file

error-monitoring-setup

Automated Sentry and error tracking setup for production applications


Overview

Automate the setup of Sentry error monitoring for Next.js, React, Node.js, and Python applications. Detects project type, installs dependencies, and configures error tracking in minutes.

Time Saved: ~45 minutes per setup

Complexity: Low

Prerequisites: Node.js/Python, Sentry account


When to Use


Supported Platforms

  1. Next.js - Full-stack React framework
  2. React - Frontend applications
  3. Node.js - Backend APIs and services
  4. Python - Flask, Django, FastAPI

Quick Start

1. Get Sentry DSN

  1. Go to sentry.io
  2. Create account (free tier available)
  3. Create new project
  4. Copy your DSN (looks like: https://...@sentry.io/...)

2. Run Setup Script

python3 /home/ubuntu/skills/error-monitoring-setup/scripts/setup_sentry.py /path/to/project <your-dsn>

3. Test Error Tracking

// Throw a test error
throw new Error("Test error - Sentry is working!");

4. Check Sentry Dashboard

Visit your Sentry dashboard to see the error.


How It Works

Phase 1: Detection

Phase 2: Installation

Phase 3: Configuration


Usage Examples

Example 1: Setup Sentry for Next.js

python3 /home/ubuntu/skills/error-monitoring-setup/scripts/setup_sentry.py ~/my-nextjs-app https://abc123@sentry.io/456

# Output:
# 📁 Project: /home/ubuntu/my-nextjs-app
# 🔑 DSN: https://abc123...
# ✅ Detected project type: nextjs
# 📦 Installing Sentry package for nextjs...
# ✅ Sentry package installed
# 📝 Creating Sentry configuration...
# ✅ Created Sentry config files
# ✅ Sentry setup complete!

Example 2: Setup Sentry for React

python3 /home/ubuntu/skills/error-monitoring-setup/scripts/setup_sentry.py ~/my-react-app https://abc123@sentry.io/456

# Output:
# 📁 Project: /home/ubuntu/my-react-app
# 🔑 DSN: https://abc123...
# ✅ Detected project type: react
# 📦 Installing Sentry package for react...
# ✅ Sentry package installed
# 📝 Creating Sentry configuration...
# ✅ Created Sentry config file
# ✅ Sentry setup complete!

Example 3: Setup Sentry for Python

python3 /home/ubuntu/skills/error-monitoring-setup/scripts/setup_sentry.py ~/my-python-app https://abc123@sentry.io/456

# Output:
# 📁 Project: /home/ubuntu/my-python-app
# 🔑 DSN: https://abc123...
# ✅ Detected project type: python
# 📦 Installing Sentry package for python...
# ✅ Sentry package installed
# 📝 Creating Sentry configuration...
# ✅ Created Sentry config file
# ✅ Sentry setup complete!

Configuration Files Created

Next.js

React

Node.js

Python


Features Enabled

Error Tracking ✅

Performance Monitoring ✅

Session Replay ✅ (Next.js/React)


Integration Steps

Next.js

Automatic - Sentry config files are automatically loaded.

Test:

// pages/index.js
export default function Home() {
  return (
    <button onClick={() => {
      throw new Error("Test error");
    }}>
      Test Sentry
    </button>
  );
}

React

Import in src/index.js:

import './sentry';
import React from 'react';
import ReactDOM from 'react-dom/client';
import App from './App';

const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(<App />);

Node.js

Import at the top of your main file:

const Sentry = require('./sentry');
const express = require('express');

const app = express();

// Your routes...

// Error handler (must be last)
app.use(Sentry.Handlers.errorHandler());

app.listen(3000);

Python

Import in your main file:

from sentry_config import *
from flask import Flask

app = Flask(__name__)

# Your routes...

if __name__ == '__main__':
    app.run()

Advanced Configuration

Custom Sample Rates

Edit config files to adjust:

Sentry.init({
  dsn: "your-dsn",
  tracesSampleRate: 0.1,  // 10% of transactions (production)
  replaysSessionSampleRate: 0.1,  // 10% of sessions
  replaysOnErrorSampleRate: 1.0,  // 100% of error sessions
});

User Context

Sentry.setUser({
  id: user.id,
  email: user.email,
  username: user.username
});

Custom Tags

Sentry.setTag("page", "checkout");
Sentry.setTag("feature", "payment");

Custom Context

Sentry.setContext("order", {
  id: "123",
  total: 99.99,
  items: 3
});

Testing Error Tracking

Manual Test

// Throw error
throw new Error("Test error - Sentry is working!");

// Or capture manually
Sentry.captureMessage("Test message");
Sentry.captureException(new Error("Test exception"));

Check Dashboard

  1. Go to Sentry dashboard
  2. Navigate to Issues
  3. Verify test error appears
  4. Check stack trace and context

Troubleshooting

Errors Not Appearing

Check DSN:

console.log(process.env.NEXT_PUBLIC_SENTRY_DSN);

Verify Initialization:

console.log("Sentry initialized");
Sentry.captureMessage("Test");

Check Network:

Wrong Project Type Detected

Manually specify project type by editing config files.

Package Installation Failed

# Next.js/React/Node.js
npm install --save @sentry/nextjs

# Python
pip install sentry-sdk

Best Practices

1. Set Appropriate Sample Rates

2. Use Environments

environment: process.env.NODE_ENV

3. Track Releases

release: "my-app@1.0.0"

4. Add User Context

Sentry.setUser({ id: user.id });

5. Filter Sensitive Data

beforeSend(event) {
  // Remove sensitive data
  delete event.request?.cookies;
  return event;
}

6. Set Up Alerts

7. Review Regularly


Sentry Pricing

Free Tier

Team ($26/month)

Business ($80/month)


Files

Scripts

Templates

References


Related Skills


Workflow

1. User creates Sentry account
2. User gets DSN from Sentry dashboard
3. User runs setup script with project path and DSN
4. Script detects project type
5. Script installs Sentry package
6. Script creates config files
7. User tests error tracking
8. Errors appear in Sentry dashboard

Success Criteria

✅ Sentry package installed

✅ Config files created

✅ Error tracking working

✅ Errors appear in dashboard

✅ Stack traces visible


Time Savings

Manual Setup: ~45 minutes

With This Skill: ~5 minutes

Savings: ~40 minutes per setup


Future Enhancements


Created: February 10, 2026

Status: Production Ready

Tested: Next.js, React, Node.js, Python

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.