From fbddd2458ea72c12258403e621dd8baf4128ebb1 Mon Sep 17 00:00:00 2001 From: default Date: Tue, 2 Jun 2026 06:23:24 +0000 Subject: [PATCH] fix: remove incompatible startTransaction API call in sentry.ts The Sentry Next.js SDK doesn't expose startTransaction at the module level in the same way. Replaced with Sentry.withScope wrapper for transaction tracing which is compatible with the installed SDK version. --- src/lib/sentry.ts | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/lib/sentry.ts b/src/lib/sentry.ts index 1b5a11f..8a24046 100644 --- a/src/lib/sentry.ts +++ b/src/lib/sentry.ts @@ -69,7 +69,20 @@ export const setUserContext = (userId: string, brandId?: string) => { }); }; -// Export for transaction tracing -export const startTransaction = (name: string, op: string = "custom") => { - return Sentry.startTransaction({ name, op }); -}; \ No newline at end of file +// Export for transaction tracing - simplified wrapper +export async function withTransaction( + name: string, + op: string, + fn: () => Promise +): Promise { + return Sentry.withScope(async (scope) => { + scope.setTransactionName(name); + try { + const result = await fn(); + return result; + } catch (error) { + Sentry.captureException(error); + throw error; + } + }); +} \ No newline at end of file