From d32691bc42084ac6c5575312dd62dfe4c1863124 Mon Sep 17 00:00:00 2001 From: Andy Cernera Date: Mon, 11 Dec 2023 19:53:34 +0900 Subject: [PATCH] chore(store-indexer): add sentry to sqlite indexer (#2057) --- packages/store-indexer/bin/sqlite-indexer.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/store-indexer/bin/sqlite-indexer.ts b/packages/store-indexer/bin/sqlite-indexer.ts index 835b2a75c2..3e04f7d9ea 100644 --- a/packages/store-indexer/bin/sqlite-indexer.ts +++ b/packages/store-indexer/bin/sqlite-indexer.ts @@ -17,12 +17,14 @@ import { isDefined } from "@latticexyz/common/utils"; import { combineLatest, filter, first } from "rxjs"; import { frontendEnvSchema, indexerEnvSchema, parseEnv } from "./parseEnv"; import { apiRoutes } from "../src/sqlite/apiRoutes"; +import { registerSentryMiddlewares } from "../src/sentry"; const env = parseEnv( z.intersection( z.intersection(indexerEnvSchema, frontendEnvSchema), z.object({ SQLITE_FILENAME: z.string().default("indexer.db"), + SENTRY_DSN: z.string().optional(), }) ) ); @@ -94,6 +96,10 @@ const server = new Koa(); server.use(cors()); server.use(apiRoutes(database)); +if (env.SENTRY_DSN) { + registerSentryMiddlewares(server); +} + const router = new Router(); router.get("/", (ctx) => {