---
title: "Hono on Cloudflare"
description: "Learn how to instrument your Hono app on Cloudflare Workers with Sentry."
url: https://docs.sentry.io/platforms/javascript/guides/cloudflare/frameworks/hono/
---

# Hono on Cloudflare | Sentry for Cloudflare

Hono has its own dedicated SDK (`@sentry/hono`) with first-class support for Cloudflare Workers, Node.js, Bun, and Deno. It works as Hono middleware, so you can drop it into an existing app.

## [Install](https://docs.sentry.io/platforms/javascript/guides/cloudflare/frameworks/hono.md#install)

Install `@sentry/hono` together with `@sentry/cloudflare`. The runtime package is a peer dependency that you never import directly, but it must be present and its version must match `@sentry/hono`.

```bash
npm install @sentry/hono @sentry/cloudflare
```

*Other available variations of the above snippet: yarn, pnpm*

## [Configure](https://docs.sentry.io/platforms/javascript/guides/cloudflare/frameworks/hono.md#configure)

The SDK needs `AsyncLocalStorage`, so set the `nodejs_compat` compatibility flag and a `compatibility_date` of `2024-09-23` or later in your Wrangler configuration:

```jsonc
{
  // Set this to today's date
  "compatibility_date": "2026-09-18",
  "compatibility_flags": ["nodejs_compat"],
}
```

*Other available variations of the above snippet: Toml*

Add the `sentry()` middleware as early as possible in your Hono app, before any route that you want covered:

```typescript
import { Hono } from "hono";
import { sentry } from "@sentry/hono/cloudflare";

const app = new Hono();

app.use(
  sentry(app, {
    dsn: "https://<key>@o<orgId>.ingest.sentry.io/<projectId>",

    // Set tracesSampleRate to 1.0 to capture 100% of spans for tracing.
    tracesSampleRate: 1.0,
  }),
);

// Your routes here

export default app;
```

To read the DSN from a Worker binding, pass a callback instead of a plain options object. The callback receives the Worker `env`:

```typescript
app.use(sentry(app, (env) => ({ dsn: env.SENTRY_DSN })));
```

For the full setup, including verification and the other runtimes, see the **[Hono Quick Start Guide](https://docs.sentry.io/platforms/javascript/guides/hono.md)**.
