Skip to main content

Hono

Beta

This page documents the Bugsee JavaScript SDK, which is in beta (0.1.x) and can change between betas.

@bugsee/hono adds a request context, an http.server transaction and error reporting to a Hono app hosted on Node.js or Bun. On Bun, see Running on Bun for the launch import and the missing http.server transaction. Read the backend overview first for how context and trace correlation work.

For Hono on an edge runtime, use the edge platform packages instead: Cloudflare or Vercel Edge.

You need an app token. Create a JavaScript application in Bugsee and choose Hono as its target; see Create your app.

Install​

npm install @bugsee/hono

The adapter declares no peer dependency. It only relies on the shape of your Hono app.

Set up​

Call launch() at the top of your server entry, then pass the app to setupHono before you register routes:

server.ts
import { launch, setupHono } from '@bugsee/hono';
import { Hono } from 'hono';

launch('<your_app_token>');

const app = new Hono();
setupHono(app);

// ... your routes ...

What it does​

setupHono registers one middleware. It opens a request context, continues an inbound traceparent, starts an http.server transaction named after the route, and, after next(), reports a handled error that Hono stored in c.error. Your app.onError handler is not touched.

A Hono HTTPException is deliberate control flow and is not reported. Any other error is reported.

Options​

Pass options as the second argument of setupHono.

OptionTypeDefaultDescription
user(c) => string | undefinedoffThe end-user identity for reports raised during the request.
shouldReport(error) => booleanskips HTTPExceptionDecides whether a thrown error is reported.
onError(error) => voidnoneReceives a failure of the adapter itself. It never reaches the request.

c is a structural view of the Hono context: c.req, c.res and c.error.

Launch options​

The adapter does not change the launch options. These are the ones that matter most on a server:

OptionDefaultDescription
instrumentIncomingRequeststrueAutomatic per-request context and http.server transaction. See the backend overview.
captureLocalVariablesfalseAttach local variables to the stack frames of a reported error. See Diagnostics.
captureSourceContextfalseAttach the source lines around each stack frame. See Diagnostics.
detectHangstrueReport event-loop hangs. See Hangs.
profilingfalseAttach a rolling CPU profile to reports. See Diagnostics.

@bugsee/hono installs @bugsee/bugsee for you and re-exports everything from its Node entry, so launch and the SDK types come from this one package. You do not install or import @bugsee/bugsee separately. On Bun, see Running on Bun.

Found an issue, typo, or wrong statement on this page? Report it now →