Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .craft.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ targets:
- name: npm
id: '@sentry/bun'
includeNames: /^sentry-bun-\d.*\.tgz$/
- name: npm
id: '@sentry/hono'
includeNames: /^sentry-hono-\d.*\.tgz$/
Comment thread
sentry[bot] marked this conversation as resolved.
- name: npm
id: '@sentry/nestjs'
includeNames: /^sentry-nestjs-\d.*\.tgz$/
Expand Down Expand Up @@ -197,6 +200,8 @@ targets:
onlyIfPresent: /^sentry-gatsby-\d.*\.tgz$/
'npm:@sentry/google-cloud-serverless':
onlyIfPresent: /^sentry-google-cloud-serverless-\d.*\.tgz$/
'npm:@sentry/hono':
onlyIfPresent: /^sentry-hono-\d.*\.tgz$/
'npm:@sentry/nestjs':
onlyIfPresent: /^sentry-nestjs-\d.*\.tgz$/
'npm:@sentry/nextjs':
Expand Down
14 changes: 10 additions & 4 deletions packages/hono/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@

## Links

- [Official SDK Docs](https://docs.sentry.io/quickstart/)
- [General SDK Docs](https://docs.sentry.io/quickstart/) - Official Docs for this Hono SDK are coming soon!

The current [Hono SDK Docs](https://docs.sentry.io/platforms/javascript/guides/hono/) explain using Sentry in Hono by using other Sentry SDKs (e.g. `@sentry/node` or `@sentry/cloudflare`)

## Install

Expand All @@ -24,9 +26,9 @@ npm install @sentry/hono

## Setup (Cloudflare Workers)

### Enable Node.js compatibility
### 1. 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.
Set the `nodejs_compat` compatibility flag in your `wrangler.jsonc`/`wrangler.toml` config. This is because the SDK needs access to the `AsyncLocalStorage` API to work correctly.

```jsonc {tabTitle:JSON} {filename:wrangler.jsonc}
{
Expand All @@ -38,7 +40,7 @@ Either set the `nodejs_compat` compatibility flags in your `wrangler.jsonc`/`wra
compatibility_flags = ["nodejs_compat"]
```

### Initialize Sentry in your Hono app
### 2. Initialize Sentry in your Hono app

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

Expand All @@ -47,12 +49,16 @@ import { sentry } from '@sentry/hono/cloudflare';

const app = new Hono();

// Initialize Sentry middleware right after creating the app
app.use(
'*',
sentry(app, {
dsn: 'your-sentry-dsn',
// ...other Sentry options
}),
);

// ... your routes and other middleware

export default app;
```
Loading