Merge branch 'sentry' into 'main'

Add Sentry hono middleware

See merge request soapbox-pub/ditto!49
This commit is contained in:
Alex Gleason 2023-10-06 01:07:05 +00:00
commit 11d4d7e549
2 changed files with 10 additions and 2 deletions

View File

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

View File

@ -6,8 +6,8 @@ export {
Hono, Hono,
HTTPException, HTTPException,
type MiddlewareHandler, type MiddlewareHandler,
} from 'https://deno.land/x/hono@v3.3.4/mod.ts'; } from 'https://deno.land/x/hono@v3.7.5/mod.ts';
export { cors, logger, serveStatic } from 'https://deno.land/x/hono@v3.3.4/middleware.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 { 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 { Author, RelayPool } from 'https://dev.jspm.io/nostr-relaypool@0.6.28';
export { 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 { default as uuid62 } from 'npm:uuid62@^1.0.2';
export { Machina } from 'https://gitlab.com/soapbox-pub/nostr-machina/-/raw/08a157d39f2741c9a3a4364cb97db36e71d8c03a/mod.ts'; 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 * 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'; export type * as TypeFest from 'npm:type-fest@^4.3.0';