Skip to content

Scheduling infrastructure for absolutely everyone.

chore: Only import Sentry when needed (#18882)

Alex van Andelc5d0d66a2642
diff --git a/packages/trpc/server/middlewares/captureErrorsMiddleware.ts b/packages/trpc/server/middlewares/captureErrorsMiddleware.ts
index 019b3715c40..8e9f19381cd 100644
--- a/packages/trpc/server/middlewares/captureErrorsMiddleware.ts
+++ b/packages/trpc/server/middlewares/captureErrorsMiddleware.ts
@@ -1,5 +1,3 @@
-import { captureException as SentryCaptureException } from "@sentry/nextjs";
-
import { redactError } from "@calcom/lib/redactError";
import { middleware } from "../trpc";
@@ -11,7 +9,8 @@ const captureErrorsMiddleware = middleware(async ({ next }) => {
if (!cause) {
return result;
}
- SentryCaptureException(cause);
+ const { captureException } = await import("@sentry/nextjs");
+ captureException(cause);
throw redactError(cause);
}
return result;