Install the sentry Node.js SDK:
npm install @sentry/node
Initialize the SDK as early as possible in your application:
const Sentry = require("@sentry/node");
Sentry.init({
dsn: "YOUR_DSN",
tracesSampleRate: 0.01, // 1% of transactions — adjust to your needs
autoSessionTracking: false, // GlitchTip does not support sessions
});
Verify your setup:
Sentry.captureMessage("Test message from Node.js");
Or trigger a test error:
myUndefinedFunction();
tracesSampleRate to a low value in production to save disk space.