This repository demonstrates how to use the standard Sentry SDK with Traque by simply configuring a Traque-compatible DSN.
Traque is API-compatible with Sentry, meaning you can use existing Sentry SDKs to send errors and events to your Traque instance.
- Node.js
- pnpm (or npm/yarn)
- A running Traque instance (or use the cloud version)
-
Install dependencies
pnpm install
-
Configure Environment
Create a
.envfile in the root directory:SENTRY_DSN=https://<your-traque-public-key>@<your-traque-host>/<project-id> PORT=3000
Important: Replace the
SENTRY_DSNvalue with your Traque DSN.- If you are running Traque locally, it might look like:
http://<public-key>@localhost:8000/<project-id> - The Sentry SDK will send events to this URL, effectively reporting to Traque instead of Sentry.
- If you are running Traque locally, it might look like:
The project uses the standard @sentry/nestjs package.
-
Initialization: In
src/instrument.ts, Sentry is initialized with the DSN from the environment variables.import * as Sentry from '@sentry/nestjs'; Sentry.init({ dsn: process.env.SENTRY_DSN, // Your Traque DSN goes here // ... other config });
-
Global Filter: The application uses a global exception filter (
src/global-exception-filter.ts) to capture exceptions. -
Bootstrap:
src/main.tsimports the instrumentation before the app starts.import './instrument'; // ...
# development
pnpm run start
# watch mode
pnpm run start:dev-
Start the application.
-
Trigger a test error using one of the built-in routes:
-
500 Error:
GET /errorcurl http://localhost:3000/error
This throws a standard
Error('Test 500 Error'). -
400 Bad Request:
POST /curl -X POST http://localhost:3000/
This throws a
BadRequestException.
-
-
Check your Traque dashboard to see the reported errors.