This is a simple Next.js application that sends sample errors to your Sentry project.
- Sentry account
- Sentry project
- Sentry auth token
Create a .env.local file in the root of the project and add the following variables:
SENTRY_ORG=your-sentry-org SENTRY_PROJECT=your-sentry-project SENTRY_AUTH_TOKEN=your-sentry-auth-tokenFirst, install the dependencies:
pnpm installNext, run the development server:
pnpm devGenerate test errors and send them to your Sentry project.
Endpoint: POST /api/generate-errors
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
dsn | string | Yes | - | Your Sentry project DSN (e.g., https://public_key@host/project_id) |
errorCount | number | No | 1 | Number of events to generate per error |
errorsToGenerate | number | No | 1 | Number of different errors to generate |
fingerprintID | string | No | - | Custom fingerprint ID. If provided, only 1 error will be generated with this fingerprint |
priority | string | No | 'HIGH' | Error priority level (HIGH, MEDIUM, LOW) |
message | string | No | - | Custom error message. If not provided, uses default format with event ID and priority |
tags | object | No | {} | Custom tags to attach to the errors |
HIGH→ Sentry level:fatalMEDIUM→ Sentry level:warningLOW→ Sentry level:info
{ "success": true, "message": "Generated 2 errors with 3 events each (Priority: HIGH)", "results": [ { "event_id": "12345678-1234-1234-1234-123456789012", "status": "sent" }, { "event_id": "87654321-4321-4321-4321-210987654321", "status": "failed", "error": "Network error" } ] }Generate a single error with default settings:
curl -X POST https://error-generator.sentry.dev/api/generate-errors \ -H "Content-Type: application/json" \ -d '{ "dsn": "https://your-public-key@your-host.ingest.sentry.io/your-project-id" }'Generate 3 different errors, each with 2 events, with high priority:
curl -X POST https://error-generator.sentry.dev/api/generate-errors \ -H "Content-Type: application/json" \ -d '{ "dsn": "https://your-public-key@your-host.ingest.sentry.io/your-project-id", "errorsToGenerate": 3, "errorCount": 2, "priority": "HIGH" }'Generate an error with custom tags and medium priority:
curl -X POST https://error-generator.sentry.dev/api/generate-errors \ -H "Content-Type: application/json" \ -d '{ "dsn": "https://your-public-key@your-host.ingest.sentry.io/your-project-id", "priority": "MEDIUM", "tags": { "team": "frontend", "feature": "user-authentication", "environment": "staging" } }'Generate an error with a custom message:
curl -X POST https://error-generator.sentry.dev/api/generate-errors \ -H "Content-Type: application/json" \ -d '{ "dsn": "https://your-public-key@your-host.ingest.sentry.io/your-project-id", "message": "Payment processing failed for user transaction", "priority": "HIGH", "tags": { "service": "payment-gateway", "user_id": "12345" } }'Generate an error with a specific fingerprint for grouping:
curl -X POST https://error-generator.sentry.dev/api/generate-errors \ -H "Content-Type: application/json" \ -d '{ "dsn": "https://your-public-key@your-host.ingest.sentry.io/your-project-id", "fingerprintID": "custom-error-group-123", "errorCount": 5, "priority": "LOW" }'If the request fails, you'll receive an error response:
{ "error": "DSN is required" }Common error scenarios:
- 400 Bad Request: Missing or invalid DSN format
- Custom tags will override default tags (including environment)
- When using
fingerprintID, only 1 error will be generated regardless oferrorsToGeneratevalue - Custom message, if provided, will replace the default message format
- All errors are automatically tagged with
generated_by: 'error-generator.sentry.dev'