From 181956384b5d6cd40234aceab47b9ab800b79374 Mon Sep 17 00:00:00 2001 From: Vectry Date: Wed, 11 Feb 2026 01:35:01 +0000 Subject: [PATCH] feat: add GlitchTip error monitoring integration --- apps/web/next.config.mjs | 8 +++++++- apps/web/package.json | 3 ++- apps/web/sentry.client.config.ts | 7 +++++++ apps/web/sentry.edge.config.ts | 7 +++++++ apps/web/sentry.server.config.ts | 7 +++++++ apps/web/src/instrumentation.ts | 13 +++++++++++++ docker-compose.yml | 2 ++ 7 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 apps/web/sentry.client.config.ts create mode 100644 apps/web/sentry.edge.config.ts create mode 100644 apps/web/sentry.server.config.ts create mode 100644 apps/web/src/instrumentation.ts diff --git a/apps/web/next.config.mjs b/apps/web/next.config.mjs index 51260eb..e7ad3a5 100644 --- a/apps/web/next.config.mjs +++ b/apps/web/next.config.mjs @@ -1,7 +1,13 @@ +import { withSentryConfig } from "@sentry/nextjs"; + /** @type {import('next').NextConfig} */ const config = { transpilePackages: ["@agentlens/database"], output: "standalone", }; -export default config; +export default withSentryConfig(config, { + silent: !process.env.CI, + disableServerWebpackPlugin: true, + disableClientWebpackPlugin: true, +}); diff --git a/apps/web/package.json b/apps/web/package.json index b2b916b..fbf6f6b 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -28,7 +28,8 @@ "shiki": "^3.22.0", "stripe": "^20.3.1", "tailwind-merge": "^3.4.0", - "zod": "^4.3.6" + "zod": "^4.3.6", + "@sentry/nextjs": "^8.28.0" }, "devDependencies": { "@tailwindcss/postcss": "^4.0.0", diff --git a/apps/web/sentry.client.config.ts b/apps/web/sentry.client.config.ts new file mode 100644 index 0000000..cd110f7 --- /dev/null +++ b/apps/web/sentry.client.config.ts @@ -0,0 +1,7 @@ +import * as Sentry from "@sentry/nextjs"; + +Sentry.init({ + dsn: process.env.NEXT_PUBLIC_SENTRY_DSN, + tracesSampleRate: process.env.NODE_ENV === "development" ? 1.0 : 0.1, + debug: false, +}); diff --git a/apps/web/sentry.edge.config.ts b/apps/web/sentry.edge.config.ts new file mode 100644 index 0000000..cd110f7 --- /dev/null +++ b/apps/web/sentry.edge.config.ts @@ -0,0 +1,7 @@ +import * as Sentry from "@sentry/nextjs"; + +Sentry.init({ + dsn: process.env.NEXT_PUBLIC_SENTRY_DSN, + tracesSampleRate: process.env.NODE_ENV === "development" ? 1.0 : 0.1, + debug: false, +}); diff --git a/apps/web/sentry.server.config.ts b/apps/web/sentry.server.config.ts new file mode 100644 index 0000000..d9bc92d --- /dev/null +++ b/apps/web/sentry.server.config.ts @@ -0,0 +1,7 @@ +import * as Sentry from "@sentry/nextjs"; + +Sentry.init({ + dsn: process.env.SENTRY_DSN || process.env.NEXT_PUBLIC_SENTRY_DSN, + tracesSampleRate: process.env.NODE_ENV === "development" ? 1.0 : 0.1, + debug: false, +}); diff --git a/apps/web/src/instrumentation.ts b/apps/web/src/instrumentation.ts new file mode 100644 index 0000000..ecb6528 --- /dev/null +++ b/apps/web/src/instrumentation.ts @@ -0,0 +1,13 @@ +import * as Sentry from "@sentry/nextjs"; + +export async function register() { + if (process.env.NEXT_RUNTIME === "nodejs") { + await import("../sentry.server.config"); + } + + if (process.env.NEXT_RUNTIME === "edge") { + await import("../sentry.edge.config"); + } +} + +export const onRequestError = Sentry.captureRequestError; diff --git a/docker-compose.yml b/docker-compose.yml index 69ac7d6..9a63646 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -16,6 +16,8 @@ services: - STRIPE_STARTER_PRICE_ID=${STRIPE_STARTER_PRICE_ID:-price_1SzJUlR8i0An4Wz7gZeYgzBY} - STRIPE_PRO_PRICE_ID=${STRIPE_PRO_PRICE_ID:-price_1SzJVWR8i0An4Wz755hBrxzn} - EMAIL_PASSWORD=${EMAIL_PASSWORD:-} + - NEXT_PUBLIC_SENTRY_DSN=https://c2b8bc3cc46246b9a629fd70c0dbf8dd@glitchtip.vectry.tech/1 + - SENTRY_DSN=https://c2b8bc3cc46246b9a629fd70c0dbf8dd@glitchtip.vectry.tech/1 depends_on: redis: condition: service_healthy