Add Sentry hono middleware

This commit is contained in:
Alex Gleason 2023-10-05 19:58:47 -05:00
parent d646598879
commit a15e28e48f
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
2 changed files with 10 additions and 2 deletions

View File

@ -1,3 +1,4 @@
import { Conf } from '@/config.ts';
import '@/cron.ts';
import { type User } from '@/db/users.ts';
import {
@ -9,6 +10,7 @@ import {
type HonoEnv,
logger,
type MiddlewareHandler,
sentryMiddleware,
serveStatic,
} from '@/deps.ts';
import '@/firehose.ts';
@ -81,6 +83,11 @@ type AppController = Handler<AppEnv>;
const app = new Hono<AppEnv>();
if (Conf.sentryDsn) {
// @ts-ignore Mismatched hono types.
app.use('*', sentryMiddleware({ dsn: Conf.sentryDsn }));
}
app.use('*', logger());
app.get('/api/v1/streaming', streamingController);

View File

@ -6,8 +6,8 @@ export {
Hono,
HTTPException,
type MiddlewareHandler,
} from 'https://deno.land/x/hono@v3.3.4/mod.ts';
export { cors, logger, serveStatic } from 'https://deno.land/x/hono@v3.3.4/middleware.ts';
} from 'https://deno.land/x/hono@v3.7.5/mod.ts';
export { cors, logger, serveStatic } from 'https://deno.land/x/hono@v3.7.5/middleware.ts';
export { z } from 'https://deno.land/x/zod@v3.21.4/mod.ts';
export { Author, RelayPool } from 'https://dev.jspm.io/nostr-relaypool@0.6.28';
export {
@ -73,5 +73,6 @@ export { default as IpfsHash } from 'npm:ipfs-only-hash@^4.0.0';
export { default as uuid62 } from 'npm:uuid62@^1.0.2';
export { Machina } from 'https://gitlab.com/soapbox-pub/nostr-machina/-/raw/08a157d39f2741c9a3a4364cb97db36e71d8c03a/mod.ts';
export * as Sentry from 'npm:@sentry/node@^7.73.0';
export { sentry as sentryMiddleware } from 'npm:@hono/sentry@^1.0.0';
export type * as TypeFest from 'npm:type-fest@^4.3.0';