Skip to content

Commit c03af5c

Browse files
authored
feat(frontend): allow sentry disable in dev (#10858)
<!-- Clearly explain the need for these changes: --> ### Changes 🏗️ <!-- Concisely describe all of the changes made in this pull request: --> Vercel is logging things it shouldnt ### Checklist 📋 #### For code changes: - [x] I have clearly listed my changes in the PR description - [x] I have made a test plan - [x] I have tested my changes according to the test plan: <!-- Put your test plan here: --> - [x] Manually verified in vercel
1 parent 00cbfb8 commit c03af5c

File tree

3 files changed

+24
-12
lines changed

3 files changed

+24
-12
lines changed

autogpt_platform/frontend/instrumentation-client.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,14 @@
55
import { BehaveAs, getBehaveAs, getEnvironmentStr } from "@/lib/utils";
66
import * as Sentry from "@sentry/nextjs";
77

8-
const shouldEnable =
9-
(process.env.NODE_ENV === "production" ||
10-
process.env.NODE_ENV === "development") &&
11-
getBehaveAs() === BehaveAs.CLOUD;
8+
const isProdOrDev =
9+
process.env.NODE_ENV === "production" ||
10+
process.env.NODE_ENV === "development";
11+
12+
const isCloud = getBehaveAs() === BehaveAs.CLOUD;
13+
const isDisabled = process.env.DISABLE_SENTRY === "true";
14+
15+
const shouldEnable = !isDisabled && isProdOrDev && isCloud;
1216

1317
Sentry.init({
1418
dsn: "https://fe4e4aa4a283391808a5da396da20159@o4505260022104064.ingest.us.sentry.io/4507946746380288",

autogpt_platform/frontend/sentry.edge.config.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,14 @@
66
import * as Sentry from "@sentry/nextjs";
77
import { BehaveAs, getBehaveAs, getEnvironmentStr } from "./src/lib/utils";
88

9-
const shouldEnable =
10-
(process.env.NODE_ENV === "production" ||
11-
process.env.NODE_ENV === "development") &&
12-
getBehaveAs() === BehaveAs.CLOUD;
9+
const isProdOrDev =
10+
process.env.NODE_ENV === "production" ||
11+
process.env.NODE_ENV === "development";
12+
13+
const isCloud = getBehaveAs() === BehaveAs.CLOUD;
14+
const isDisabled = process.env.DISABLE_SENTRY === "true";
15+
16+
const shouldEnable = !isDisabled && isProdOrDev && isCloud;
1317

1418
Sentry.init({
1519
dsn: "https://fe4e4aa4a283391808a5da396da20159@o4505260022104064.ingest.us.sentry.io/4507946746380288",

autogpt_platform/frontend/sentry.server.config.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,14 @@ import { BehaveAs, getBehaveAs, getEnvironmentStr } from "@/lib/utils";
66
import * as Sentry from "@sentry/nextjs";
77
// import { NodeProfilingIntegration } from "@sentry/profiling-node";
88

9-
const shouldEnable =
10-
(process.env.NODE_ENV === "production" ||
11-
process.env.NODE_ENV === "development") &&
12-
getBehaveAs() === BehaveAs.CLOUD;
9+
const isProdOrDev =
10+
process.env.NODE_ENV === "production" ||
11+
process.env.NODE_ENV === "development";
12+
13+
const isCloud = getBehaveAs() === BehaveAs.CLOUD;
14+
const isDisabled = process.env.DISABLE_SENTRY === "true";
15+
16+
const shouldEnable = !isDisabled && isProdOrDev && isCloud;
1317

1418
Sentry.init({
1519
dsn: "https://fe4e4aa4a283391808a5da396da20159@o4505260022104064.ingest.us.sentry.io/4507946746380288",

0 commit comments

Comments
 (0)