Skip to content

Commit 8080f67

Browse files
Shannon Anahatasfanahata
authored andcommitted
updating hono to have proper snippets
1 parent f2ecbfc commit 8080f67

File tree

2 files changed

+42
-1
lines changed

2 files changed

+42
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ The main Sentry configuration should happen as early as possible in your app's l
4040

4141
<PlatformContent
4242
includePath="getting-started-config"
43-
platform="javascript.cloudflare.workers"
43+
platform="javascript.cloudflare.hono"
4444
/>
4545

4646
### Migration from Community Middleware
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
Wrap your Hono app with the `withSentry` function, for example, in your `index.ts` file, to initialize the Sentry SDK and hook into the environment:
2+
3+
```typescript {filename:index.ts}
4+
import { Env, Hono } from "hono";
5+
import * as Sentry from "@sentry/cloudflare";
6+
7+
const app = new Hono();
8+
9+
// Add your routes here
10+
// app.get('/your-route', (c) => c.text('Hello!'));
11+
12+
export default Sentry.withSentry(
13+
(env: Env) => {
14+
const { id: versionId } = env.CF_VERSION_METADATA;
15+
16+
return {
17+
dsn: "___PUBLIC_DSN___",
18+
19+
release: versionId,
20+
21+
// Adds request headers and IP for users, for more info visit:
22+
// https://docs.sentry.io/platforms/javascript/guides/cloudflare/configuration/options/#sendDefaultPii
23+
sendDefaultPii: true,
24+
// ___PRODUCT_OPTION_START___ logs
25+
26+
// Enable logs to be sent to Sentry
27+
enableLogs: true,
28+
// ___PRODUCT_OPTION_END___ logs
29+
// ___PRODUCT_OPTION_START___ performance
30+
31+
// Set tracesSampleRate to 1.0 to capture 100% of spans for tracing.
32+
// Learn more at
33+
// https://docs.sentry.io/platforms/javascript/guides/cloudflare/configuration/options/#tracesSampleRate
34+
tracesSampleRate: 1.0,
35+
// ___PRODUCT_OPTION_END___ performance
36+
};
37+
},
38+
app
39+
);
40+
```
41+

0 commit comments

Comments
 (0)