← All platforms

Hapi error tracking

Your Hapi server has routes, plugins, and the occasional unhappy request. Use the Sentry integration to keep those error reports on your Telebugs server.

~/hoofnotes  npm install @sentry/node
~/hoofnotes  nvim instrument.mjs app.mjs
import * as Sentry from "@sentry/node";
Sentry.init({
// Copy the complete Telebugs DSN, key and path included.
dsn: "YOUR_TELEBUGS_DSN",
});
import * as Sentry from "@sentry/node";
import { server } from "./hoofnotes/server.mjs";
await Sentry.setupHapiErrorHandler(server);
await server.start();
~/hoofnotes  node --import ./instrument.mjs app.mjs

Space pauses or resumes. R replays. Escape shows the complete setup.

Hang on, I already use Sentry

Keep @sentry/node and change its destination to your Telebugs DSN. Your error reports stay on your server. You don’t need a Sentry account.

What if the exception comes from a plugin?

Unhandled errors reaching Hapi’s request error handling can be reported, including failures inside plugins. The backtrace helps you follow the calls into the code that failed.

Does every unsuccessful response become an error?

No. An intentional client-error response is different from an unexpected exception. Your SDK configuration determines which failures become reports.