Skip to content

Latest commit

 

History

History
58 lines (40 loc) · 1.49 KB

File metadata and controls

58 lines (40 loc) · 1.49 KB

Sentry

Official Sentry SDK for Hono (ALPHA)

npm version npm dm npm dt

Links

Install

To get started, first install the @sentry/hono package:

npm install @sentry/hono

Setup (Cloudflare Workers)

Enable Node.js compatibility

Either set the nodejs_compat compatibility flags in your wrangler.jsonc/wrangler.toml config. This is because the SDK needs access to the AsyncLocalStorage API to work correctly.

{
  "compatibility_flags": ["nodejs_compat"],
}
compatibility_flags = ["nodejs_compat"]

Initialize Sentry in your Hono app

Initialize the Sentry Hono middleware as early as possible in your app:

import { sentry } from '@sentry/hono/cloudflare';

const app = new Hono();

app.use(
  '*',
  sentry(app, {
    dsn: 'your-sentry-dsn',
  }),
);

export default app;