Skip to content

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

fix(frontend): stop forwarding browser deprecation reports to Sentry (#14716)

Bently7168e409237e
diff --git a/autogpt_platform/frontend/instrumentation-client.ts b/autogpt_platform/frontend/instrumentation-client.ts
index a7808e5365..67b6174e07 100644
--- a/autogpt_platform/frontend/instrumentation-client.ts
+++ b/autogpt_platform/frontend/instrumentation-client.ts
@@ -38,7 +38,11 @@ Sentry.init({
unmask: [".sentry-unmask, [data-sentry-unmask]"],
}),
Sentry.replayCanvasIntegration(),
- Sentry.reportingObserverIntegration(),
+ // Deprecation reports are browser platform notices about the web platform
+ // itself (e.g. Chrome's "Attribution Reporting is deprecated"), not bugs in
+ // our code, and they bury real issues. Crash and intervention reports still
+ // come through.
+ Sentry.reportingObserverIntegration({ types: ["crash", "intervention"] }),
// Sentry.feedbackIntegration({
// // Additional SDK configuration goes in here, for example:
// colorScheme: "system",
diff --git a/autogpt_platform/frontend/src/__tests__/instrumentation-client.test.ts b/autogpt_platform/frontend/src/__tests__/instrumentation-client.test.ts
new file mode 100644
index 0000000000..d7a60e7491
--- /dev/null
+++ b/autogpt_platform/frontend/src/__tests__/instrumentation-client.test.ts
@@ -0,0 +1,43 @@
+import { describe, expect, it, vi } from "vitest";
+
+const { initMock, reportingObserverIntegrationMock } = vi.hoisted(() => ({
+ initMock: vi.fn(),
+ reportingObserverIntegrationMock: vi.fn((options?: { types?: string[] }) => ({
+ name: "ReportingObserver",
+ options,
+ })),
+}));
+
+vi.mock("@sentry/nextjs", () => {
+ function stubIntegration(name: string) {
+ return vi.fn(() => ({ name }));
+ }
+
+ return {
+ init: initMock,
+ reportingObserverIntegration: reportingObserverIntegrationMock,
+ captureConsoleIntegration: stubIntegration("CaptureConsole"),
+ extraErrorDataIntegration: stubIntegration("ExtraErrorData"),
+ browserProfilingIntegration: stubIntegration("BrowserProfiling"),
+ httpClientIntegration: stubIntegration("HttpClient"),
+ launchDarklyIntegration: stubIntegration("LaunchDarkly"),
+ replayIntegration: stubIntegration("Replay"),
+ replayCanvasIntegration: stubIntegration("ReplayCanvas"),
+ captureRouterTransitionStart: vi.fn(),
+ };
+});
+
+describe("Sentry client instrumentation", () => {
+ it("does not forward browser deprecation reports to Sentry", async () => {
+ await import("../../instrumentation-client");
+
+ expect(initMock).toHaveBeenCalledTimes(1);
+ expect(reportingObserverIntegrationMock).toHaveBeenCalledTimes(1);
+
+ const types = reportingObserverIntegrationMock.mock.calls[0][0]?.types;
+
+ expect(types).toBeDefined();
+ expect(types).not.toContain("deprecation");
+ expect(types).toEqual(expect.arrayContaining(["crash", "intervention"]));
+ });
+});