From 3100e758cf151283ac9272d96a8bf310c40fc7b1 Mon Sep 17 00:00:00 2001 From: "sentry[bot]" <39604003+sentry[bot]@users.noreply.github.com> Date: Tue, 5 May 2026 10:29:12 +0000 Subject: [PATCH] Fix: Properly configure Sentry SDK and enable metrics --- instrumentation-client.ts | 12 ++++++++++++ instrumentation.ts | 11 +++++++++++ next.config.ts | 7 ++++++- package.json | 1 + sentry.edge.config.ts | 9 +++++++++ sentry.server.config.ts | 9 +++++++++ 6 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 instrumentation-client.ts create mode 100644 instrumentation.ts create mode 100644 sentry.edge.config.ts create mode 100644 sentry.server.config.ts diff --git a/instrumentation-client.ts b/instrumentation-client.ts new file mode 100644 index 0000000..96ea9c9 --- /dev/null +++ b/instrumentation-client.ts @@ -0,0 +1,12 @@ +import * as Sentry from "@sentry/nextjs"; + +Sentry.init({ + dsn: "https://c3309793f20fd802c7ba3b48508430f7@o4508130833793024.ingest.us.sentry.io/4510869094793216", + tracesSampleRate: 1.0, + replaysSessionSampleRate: 0.1, + replaysOnErrorSampleRate: 1.0, + integrations: [Sentry.replayIntegration()], + _experiments: { + enableLogs: true, + }, +}); \ No newline at end of file diff --git a/instrumentation.ts b/instrumentation.ts new file mode 100644 index 0000000..9d6a01a --- /dev/null +++ b/instrumentation.ts @@ -0,0 +1,11 @@ +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 = (await import("@sentry/nextjs")).captureRequestError; \ No newline at end of file diff --git a/next.config.ts b/next.config.ts index cb651cd..b785d58 100644 --- a/next.config.ts +++ b/next.config.ts @@ -1,5 +1,10 @@ import type { NextConfig } from "next"; +import { withSentryConfig } from "@sentry/nextjs"; const nextConfig: NextConfig = {}; -export default nextConfig; +export default withSentryConfig(nextConfig, { + org: "buildwithcode", + project: "gko-hack-desktop", + silent: !process.env.CI, +}); diff --git a/package.json b/package.json index e4d873b..df64ea9 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ }, "dependencies": { "@anthropic-ai/claude-agent-sdk": "^0.2.20", + "@sentry/nextjs": "^10.38.0", "@radix-ui/react-avatar": "^1.1.11", "@radix-ui/react-dialog": "^1.1.15", "@radix-ui/react-dropdown-menu": "^2.1.16", diff --git a/sentry.edge.config.ts b/sentry.edge.config.ts new file mode 100644 index 0000000..049f5ba --- /dev/null +++ b/sentry.edge.config.ts @@ -0,0 +1,9 @@ +import * as Sentry from "@sentry/nextjs"; + +Sentry.init({ + dsn: "https://c3309793f20fd802c7ba3b48508430f7@o4508130833793024.ingest.us.sentry.io/4510869094793216", + tracesSampleRate: 1.0, + _experiments: { + enableLogs: true, + }, +}); \ No newline at end of file diff --git a/sentry.server.config.ts b/sentry.server.config.ts new file mode 100644 index 0000000..049f5ba --- /dev/null +++ b/sentry.server.config.ts @@ -0,0 +1,9 @@ +import * as Sentry from "@sentry/nextjs"; + +Sentry.init({ + dsn: "https://c3309793f20fd802c7ba3b48508430f7@o4508130833793024.ingest.us.sentry.io/4510869094793216", + tracesSampleRate: 1.0, + _experiments: { + enableLogs: true, + }, +}); \ No newline at end of file