Node.js
Bugtail works with the official Sentry SDK for Node.js, for a server, a worker or a command-line tool.
Install
npm install @sentry/node
Configure
Initialise the SDK in a file of its own, so it can load before anything else:
// instrument.mjs
import * as Sentry from '@sentry/node';
Sentry.init({
dsn: 'https://<key>@ingest.bugtail.eu/<project-id>',
release: '[email protected]',
environment: 'production',
tracesSampleRate: 0.2,
});
Then load it first. Instrumentation only sees what starts after it:
node --import ./instrument.mjs app.mjs
Copy the DSN from your collector under Settings > Projects and collectors. Leave out tracesSampleRate to report errors only.
Express
Add the error handler after all your routes:
import * as Sentry from '@sentry/node';
Sentry.setupExpressErrorHandler(app);
Send a test event
Sentry.captureMessage('Bugtail test event');