Integrate Sentry with Elysia

This commit is contained in:
Bilal Godil
2026-07-14 19:21:37 -07:00
parent a156583522
commit e78b956f06
3 changed files with 484 additions and 341 deletions
+3 -2
View File
@@ -85,8 +85,9 @@
"@prisma/client": "^7.0.0",
"@prisma/extension-read-replicas": "^0.5.0",
"@prisma/instrumentation": "^7.0.0",
"@sentry/browser": "^10.45.0",
"@sentry/node": "^10.45.0",
"@sentry/browser": "^10.55.0",
"@sentry/elysia": "^10.55.0",
"@sentry/node": "^10.55.0",
"@sentry/rollup-plugin": "^4.6.1",
"@simplewebauthn/server": "^13.3.0",
"@sinclair/typebox": "^0.34.49",
+6 -1
View File
@@ -4,6 +4,7 @@ import { NextNotFoundError } from "@/lib/runtime/navigation";
import { parseCookieHeader, requestContextALS, type RequestContext } from "@/lib/runtime/request-context";
import { node } from "@elysiajs/node";
import { getEnvVariable, getNodeEnvironment } from "@hexclave/shared/dist/utils/env";
import * as Sentry from "@sentry/elysia";
import { Elysia } from "elysia";
import { createBackendRequest } from "./backend-request";
import { handleUncaughtBackendError } from "./error-handler";
@@ -22,8 +23,12 @@ const knownHttpMethods = new Set<string>(httpMethodNames);
const developmentRequestStartTimes = new WeakMap<Request, number>();
const shouldLogDevelopmentRequests = getNodeEnvironment() === "development";
export const app = new Elysia({
export const app = Sentry.withElysia(new Elysia({
adapter: node(),
}), {
// The global backend error boundary adds location metadata before capturing errors.
// Keep it as the single capture owner so the framework integration does not emit duplicates.
shouldHandleError: () => false,
})
.onRequest(({ request }) => {
if (shouldLogDevelopmentRequests) {
+475 -338
View File
File diff suppressed because it is too large Load Diff