diff --git a/.env.example b/.env.example index dee4d6d081..2906b2f69d 100644 --- a/.env.example +++ b/.env.example @@ -166,6 +166,7 @@ SENTRY_AUTH_TOKEN= NEXT_PUBLIC_SENTRY_DSN= SENTRY_DEBUG= SENTRY_MAX_SPANS= +SENTRY_SAMPLE_RATE= SENTRY_TRACES_SAMPLE_RATE= SENTRY_REPLAYS_SESSION_SAMPLE_RATE= SENTRY_REPLAYS_ON_ERROR_SAMPLE_RATE= diff --git a/apps/web/instrumentation-client.ts b/apps/web/instrumentation-client.ts index 35224a59c9..21d2469be3 100644 --- a/apps/web/instrumentation-client.ts +++ b/apps/web/instrumentation-client.ts @@ -6,6 +6,7 @@ import * as Sentry from "@sentry/nextjs"; Sentry.init({ dsn: process.env.NEXT_PUBLIC_SENTRY_DSN, + sampleRate: parseFloat(process.env.SENTRY_SAMPLE_RATE ?? "1.0") || 1.0, // Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control. tracesSampleRate: parseFloat(process.env.SENTRY_TRACES_SAMPLE_RATE ?? "0.0") || 0.0, diff --git a/apps/web/sentry.edge.config.ts b/apps/web/sentry.edge.config.ts index e81e056996..01c519a63f 100644 --- a/apps/web/sentry.edge.config.ts +++ b/apps/web/sentry.edge.config.ts @@ -6,7 +6,7 @@ import * as Sentry from "@sentry/nextjs"; Sentry.init({ dsn: process.env.NEXT_PUBLIC_SENTRY_DSN, - + sampleRate: parseFloat(process.env.SENTRY_SAMPLE_RATE ?? "1.0") || 1.0, // Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control. tracesSampleRate: parseFloat(process.env.SENTRY_TRACES_SAMPLE_RATE ?? "0.0") || 0.0, diff --git a/apps/web/sentry.server.config.ts b/apps/web/sentry.server.config.ts index 2310605cc1..aebf5035dc 100644 --- a/apps/web/sentry.server.config.ts +++ b/apps/web/sentry.server.config.ts @@ -6,6 +6,7 @@ import * as Sentry from "@sentry/nextjs"; Sentry.init({ debug: !!process.env.SENTRY_DEBUG, dsn: process.env.NEXT_PUBLIC_SENTRY_DSN, + sampleRate: parseFloat(process.env.SENTRY_SAMPLE_RATE ?? "1.0") || 1.0, tracesSampleRate: parseFloat(process.env.SENTRY_TRACES_SAMPLE_RATE ?? "0.0") || 0.0, integrations: [Sentry.prismaIntegration()], beforeSend(event) { diff --git a/packages/app-store/googlecalendar/api/webhook.ts b/packages/app-store/googlecalendar/api/webhook.ts index 9041da6e6e..bf823b07ca 100644 --- a/packages/app-store/googlecalendar/api/webhook.ts +++ b/packages/app-store/googlecalendar/api/webhook.ts @@ -31,17 +31,14 @@ async function postHandler(req: NextApiRequest) { const selectedCalendar = await SelectedCalendarRepository.findFirstByGoogleChannelId(channelId); if (!selectedCalendar) { - throw new HttpError({ - statusCode: 200, - message: `No selected calendar found for googleChannelId: ${channelId}`, - }); + log.info("postHandler", `No selected calendar found for googleChannelId: ${channelId}`); + return { message: "ok" }; } const { credential } = selectedCalendar; - if (!credential) - throw new HttpError({ - statusCode: 200, - message: `No credential found for selected calendar for googleChannelId: ${channelId}`, - }); + if (!credential) { + log.info("postHandler", `No credential found for selected calendar for googleChannelId: ${channelId}`); + return { message: "ok" }; + } const { selectedCalendars } = credential; const credentialForCalendarCache = await getCredentialForCalendarCache({ credentialId: credential.id }); const calendarServiceForCalendarCache = await getCalendar(credentialForCalendarCache); diff --git a/turbo.json b/turbo.json index 28b389cb56..3bb7798a38 100644 --- a/turbo.json +++ b/turbo.json @@ -43,6 +43,7 @@ "SENTRY_MAX_SPANS", "SENTRY_ORG", "SENTRY_PROJECT", + "SENTRY_SAMPLE_RATE", "SENTRY_TRACES_SAMPLE_RATE", "SENTRY_REPLAYS_SESSION_SAMPLE_RATE", "SENTRY_REPLAYS_ON_ERROR_SAMPLE_RATE",