Hono
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
- pnpm
- yarn
- bun
npm install @bugsee/hono
pnpm add @bugsee/hono
yarn add @bugsee/hono
bun add @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:
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.
| Option | Type | Default | Description |
|---|---|---|---|
user | (c) => string | undefined | off | The end-user identity for reports raised during the request. |
shouldReport | (error) => boolean | skips HTTPException | Decides whether a thrown error is reported. |
onError | (error) => void | none | Receives 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:
| Option | Default | Description |
|---|---|---|
instrumentIncomingRequests | true | Automatic per-request context and http.server transaction. See the backend overview. |
captureLocalVariables | false | Attach local variables to the stack frames of a reported error. See Diagnostics. |
captureSourceContext | false | Attach the source lines around each stack frame. See Diagnostics. |
detectHangs | true | Report event-loop hangs. See Hangs. |
profiling | false | Attach 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.
Related pages
- Backend overview — request context, trace correlation and incoming-request instrumentation
- Issue detection — what else is detected on a server
- Performance — transactions and spans