Skip to content

Commit 3a5d0d1

Browse files
sfanahataShannon Anahata
andauthored
Hono runtime and middleware doc updates (#14853)
## DESCRIBE YOUR PR We're switching over from the community middleware integration via `tucan-js` to the official `@sentry/cloudflare` integration. Updating docs to reflect that, and give a bit more context for other runtimes. Related to: honojs/middleware#943 ## IS YOUR CHANGE URGENT? Help us prioritize incoming PRs by letting us know when the change needs to go live. - [ ] Urgent deadline (GA date, etc.): <!-- ENTER DATE HERE --> - [x] Other deadline: TBD - [ ] None: Not urgent, can wait up to 1 week+ ## SLA - Teamwork makes the dream work, so please add a reviewer to your PRs. - Please give the docs team up to 1 week to review your PR unless you've added an urgent due date to it. Thanks in advance for your help! ## PRE-MERGE CHECKLIST *Make sure you've checked the following before merging your changes:* - [ ] Checked Vercel preview for correctness, including links - [ ] PR was reviewed and approved by any necessary SMEs (subject matter experts) - [ ] PR was reviewed and approved by a member of the [Sentry docs team](https://github.com/orgs/getsentry/teams/docs) Co-authored-by: Shannon Anahata <[email protected]>
1 parent 71d2d80 commit 3a5d0d1

File tree

2 files changed

+106
-4
lines changed

2 files changed

+106
-4
lines changed

docs/platforms/javascript/guides/cloudflare/frameworks/hono.mdx

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ description: "Learn how to instrument your Hono app on Cloudflare Workers and ca
55

66
<PlatformContent includePath="getting-started-primer" />
77

8+
<Alert type="warning" title="Community Middleware Deprecation">
9+
The community-maintained `@hono/sentry` middleware that uses `toucan-js` has been deprecated in favor of
10+
using `@sentry/cloudflare` directly.
11+
If you're currently using the `@hono/sentry` middleware with `toucan-js`, you should migrate to
12+
`@sentry/cloudflare` directly as shown in this guide.
13+
</Alert>
14+
815
## Step 1: Install
916

1017
Choose the features you want to configure, and this guide will show you how:
@@ -36,6 +43,27 @@ The main Sentry configuration should happen as early as possible in your app's l
3643
platform="javascript.cloudflare.workers"
3744
/>
3845

46+
### Migration from Community Middleware
47+
48+
If you're currently using the `@hono/sentry` middleware, migrate to the official `@sentry/cloudflare` middleware:
49+
50+
```javascript
51+
// New approach using official Sentry SDK
52+
import { Hono } from 'hono';
53+
import * as Sentry from '@sentry/cloudflare';
54+
55+
const app = new Hono();
56+
57+
// Wrap your app with Sentry
58+
export default Sentry.withSentry(
59+
(env: Env) => ({
60+
dsn: '___PUBLIC_DSN___',
61+
tracesSampleRate: 1.0,
62+
}),
63+
app
64+
);
65+
```
66+
3967
<PlatformContent
4068
includePath="getting-started-capture-errors"
4169
platform="javascript.hono"

docs/platforms/javascript/guides/hono/index.mdx

Lines changed: 78 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,84 @@ categories:
1111

1212
<PlatformContent includePath="getting-started-primer" />
1313

14-
<Alert type="warning" title="Important">
15-
This guide assumes you're using the **Node.js runtime** for Hono. For setup
16-
instructions on Cloudflare Workers, see our [Hono on Cloudflare
17-
guide](/platforms/javascript/guides/cloudflare/frameworks/hono/).
14+
<Alert type="warning" title="Runtime-Specific Setup">
15+
This guide focuses on the **Node.js runtime** for Hono. For other runtimes, see the links below.
16+
If you are using the `@sentry/cloudflare` middleware, see the [Hono on Cloudflare guide](/platforms/javascript/guides/cloudflare/frameworks/hono/).
1817
</Alert>
1918

19+
## Runtime Support
20+
21+
Hono works across multiple JavaScript runtimes. Choose the appropriate Sentry SDK for your environment:
22+
23+
- **Node.js**: Use `@sentry/node` (this guide)
24+
- **Cloudflare Workers**: Use `@sentry/cloudflare` - see our [Hono on Cloudflare guide](/platforms/javascript/guides/cloudflare/frameworks/hono/)
25+
- **Deno**: Use `@sentry/deno` - see our [Deno guide](/platforms/javascript/guides/deno/) (Beta)
26+
- **Bun**: Use `@sentry/bun` - see our [Bun guide](/platforms/javascript/guides/bun/)
27+
28+
<Alert>
29+
The community middleware `@hono/sentry` has been deprecated in favor of using Sentry's official
30+
packages, which provide better performance and more features. If you're currently using `@hono/sentry` middleware, you'll need to migrate to `@sentry/cloudflare`.
31+
</Alert>
32+
33+
## Runtime-Specific Setup
34+
35+
### Node.js Runtime (This Guide)
36+
37+
This guide focuses on Node.js. The setup uses `@sentry/node` and follows standard Node.js patterns.
38+
2039
<PlatformContent includePath="getting-started-node" />
40+
41+
### Other Runtimes
42+
43+
For other runtimes, use the appropriate Sentry SDK:
44+
45+
<Expandable title="Deno Runtime (Beta)">
46+
```javascript
47+
// For Deno, use @sentry/deno (currently in Beta)
48+
import * as Sentry from "npm:@sentry/deno";
49+
import { Hono } from "hono";
50+
51+
Sentry.init({
52+
dsn: "___PUBLIC_DSN___",
53+
tracesSampleRate: 1.0,
54+
});
55+
56+
const app = new Hono();
57+
// Your Hono app setup...
58+
```
59+
</Expandable>
60+
61+
<Expandable title="Bun Runtime">
62+
```javascript
63+
// For Bun, use @sentry/bun
64+
import * as Sentry from "@sentry/bun";
65+
import { Hono } from "hono";
66+
67+
// Initialize Sentry before importing other modules
68+
Sentry.init({
69+
dsn: "___PUBLIC_DSN___",
70+
tracesSampleRate: 1.0,
71+
});
72+
73+
const app = new Hono();
74+
// Your Hono app setup...
75+
```
76+
</Expandable>
77+
78+
<Expandable title="Cloudflare Workers">
79+
```javascript
80+
// For Cloudflare Workers, use @sentry/cloudflare
81+
import * as Sentry from "@sentry/cloudflare";
82+
import { Hono } from "hono";
83+
84+
const app = new Hono();
85+
86+
export default Sentry.withSentry(
87+
(env: Env) => ({
88+
dsn: "___PUBLIC_DSN___",
89+
tracesSampleRate: 1.0,
90+
}),
91+
app
92+
);
93+
```
94+
</Expandable>

0 commit comments

Comments
 (0)