Node.js

Install npm install @sentry/node

The official @sentry/node package reports to Blipit with the DSN swapped. Load it before anything else so it can catch errors from the start.

1Install

sh
npm install @sentry/node

2Initialise first

Put this in a file that runs before your app, and import it first (or use node --import ./instrument.mjs).

instrument.mjs
import * as Sentry from "@sentry/node";

Sentry.init({
  dsn: "https://<public key>@in.blipit.io/<project id>",
  environment: process.env.NODE_ENV,
  release: process.env.RELEASE,
  tracesSampleRate: 0.2,
});

3Express

Add the error handler after your routes so handled and unhandled errors both reach Blipit.

js
import "./instrument.mjs";
import * as Sentry from "@sentry/node";
import express from "express";

const app = express();
app.get("/", (req, res) => res.send("ok"));
Sentry.setupExpressErrorHandler(app);
app.listen(3000);

4Check it works

Open Issues in app.blipit.io. The first event appears within a few seconds, grouped into an issue, and the people in charge get an email.

js
Sentry.captureMessage("Hello from Node");

Good to know

  • No package at all? POST an event to https://in.blipit.io/api/v1/events with X-Blipit-Key; the Keys page in the dashboard shows the JSON.
  • Logs and login attempts from Node are separate calls; see Logs and Login attempts.

Stuck? Email support@blipit.io. Keys and the exact DSN for each project are under API keys in app.blipit.io.