Quickstart
From zero to your first captured error in about two minutes. You need a Trapify project and its DSN key — create one here if you have not already.
1. Install and initialise
Call init once, as early as possible in your entry point, so errors thrown during startup
are captured too.
npm install @trapify-tech/browser
import * as Trapify from '@trapify-tech/browser';
Trapify.init({ dsn: 'https://<key>@trapify.tech/<id>' }); 2. Where the DSN comes from
Every project has one DSN. Copy it from the project settings screen in the dashboard. It is a public value — it identifies the project the event belongs to and carries no account credentials — but treat it as you would any other config value and inject it through your environment rather than hardcoding it.
3. What gets captured automatically
window.onerror— uncaught exceptionsunhandledrejection— rejected promises with no handler- Breadcrumbs: console output, fetch calls, and navigation events preceding the error
- The full stack trace with in-app frame detection
In Node.js the SDK hooks process.uncaughtException and
unhandledRejection instead; fetch and navigation breadcrumbs are skipped automatically.
4. Capturing manually
Anything you catch yourself can still be reported.
import * as Trapify from '@trapify-tech/browser';
try {
await checkout(cart);
} catch (err) {
Trapify.captureException(err);
} 5. Filtering sensitive data
beforeSend runs in the browser before anything leaves the page. Mutate the event and
return it, or return null to drop it.
Trapify.init({
dsn: import.meta.env.VITE_TRAPIFY_DSN,
beforeSend(event) {
// Return null to drop the event entirely.
if (event.environment === 'development') return null;
delete event.user?.email;
return event;
},
}); Next
- Already using Sentry? Keep your SDK and change one environment variable.
- See what the free tier includes.