🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
fix(web): drop unsupported HTML media NotSupportedError from Sentry (#16791)
cursor[bot]539649b5e3b6
diff --git a/web/src/components/ui/splash-screen.clienttest.tsx b/web/src/components/ui/splash-screen.clienttest.tsxnew file mode 100644index 0000000000..376db1a3bd--- /dev/null+++ b/web/src/components/ui/splash-screen.clienttest.tsx@@ -0,0 +1,65 @@+import { fireEvent, render, waitFor } from "@testing-library/react";+import { afterEach, describe, expect, it, vi } from "vitest";++import { SplashScreen } from "./splash-screen";++describe("SplashScreen video autoplay", () => {+ afterEach(() => {+ vi.restoreAllMocks();+ });++ it("hides the player when play() rejects with NotSupportedError", async () => {+ vi.spyOn(window.HTMLMediaElement.prototype, "play").mockRejectedValue(+ new DOMException(+ "The media resource indicated by the src attribute or assigned media provider object was not suitable.",+ "NotSupportedError",+ ),+ );++ const { container } = render(+ <SplashScreen+ title="Time to log your first trace"+ description="Get your API keys first."+ videoSrc="https://example.com/onboarding.mp4"+ />,+ );++ const video = container.querySelector("video");+ expect(video).not.toBeNull();+ expect(video).not.toHaveAttribute("autoplay");++ fireEvent.loadedData(video!);++ await waitFor(() => {+ expect(video!.parentElement).toHaveClass("hidden");+ });+ });++ it("keeps the player visible when play() is rejected as NotAllowedError", async () => {+ const play = vi+ .spyOn(window.HTMLMediaElement.prototype, "play")+ .mockRejectedValue(+ new DOMException(+ "play() failed because the user didn't interact with the document first",+ "NotAllowedError",+ ),+ );++ const { container } = render(+ <SplashScreen+ title="Time to log your first trace"+ description="Get your API keys first."+ videoSrc="https://example.com/onboarding.mp4"+ />,+ );++ const video = container.querySelector("video");+ expect(video).not.toBeNull();+ fireEvent.loadedData(video!);++ await waitFor(() => {+ expect(play).toHaveBeenCalled();+ });+ expect(video!.parentElement).not.toHaveClass("hidden");+ });+});diff --git a/web/src/components/ui/splash-screen.tsx b/web/src/components/ui/splash-screen.tsxindex 856db4e7f0..106405cb3e 100644--- a/web/src/components/ui/splash-screen.tsx+++ b/web/src/components/ui/splash-screen.tsx@@ -62,14 +62,28 @@ function VideoPlayer({ videoSrc }: { videoSrc: string }) {<videosrc={videoSrc}controls- autoPlaymutedloopplaysInlinecontrolsList="nodownload"className="w-full"onError={() => setHasError(true)}- onLoadedData={() => setIsLoaded(true)}+ onLoadedData={(event) => {+ setIsLoaded(true);+ // Firefox rejects play() with NotSupportedError when the codec is+ // unavailable; hide the player. NotAllowedError is autoplay policy.+ // Other rejections rethrow so they stay visible to error reporting.+ return event.currentTarget.play().catch((error: unknown) => {+ if (error instanceof DOMException) {+ if (error.name === "NotSupportedError") {+ setHasError(true);+ return;+ }+ if (error.name === "NotAllowedError") return;+ }+ throw error;+ });+ }}/></div>);diff --git a/web/src/utils/sentryFilters.clienttest.ts b/web/src/utils/sentryFilters.clienttest.tsindex 84701a397b..875b3a2a91 100644--- a/web/src/utils/sentryFilters.clienttest.ts+++ b/web/src/utils/sentryFilters.clienttest.ts@@ -315,6 +315,60 @@ describe("isDenylistedNoiseEvent", () => {).toBe(true);});+ // Firefox (and Chromium) reject HTMLMediaElement resource selection /+ // autoplay as an unhandled NotSupportedError when the codec is unavailable+ // (typical on Linux without proprietary codecs). The splash onboarding+ // videos and inline audio/video players already degrade in the UI; the+ // native promise has no app stack for us to catch.+ const unsupportedMediaResourceEvent = (+ value: string,+ type = "NotSupportedError",+ mechanismType = "auto.browser.global_handlers.onunhandledrejection",+ ): ErrorEvent =>+ ({+ exception: {+ values: [+ {+ type,+ value,+ mechanism: { type: mechanismType, handled: false },+ },+ ],+ },+ }) as ErrorEvent;++ it("drops Firefox HTMLMediaElement NotSupportedError (LANGFUSE-60C)", () => {+ expect(+ isDenylistedNoiseEvent(+ unsupportedMediaResourceEvent(+ "The media resource indicated by the src attribute or assigned media provider object was not suitable.",+ ),+ ),+ ).toBe(true);+ });++ it("drops Chromium HTMLMediaElement NotSupportedError", () => {+ expect(+ isDenylistedNoiseEvent(+ unsupportedMediaResourceEvent(+ "Failed to load because no supported source was found.",+ ),+ ),+ ).toBe(true);+ });++ it("drops the same Firefox media error from the global onerror handler", () => {+ expect(+ isDenylistedNoiseEvent(+ unsupportedMediaResourceEvent(+ "The media resource indicated by the src attribute or assigned media provider object was not suitable.",+ "NotSupportedError",+ "auto.browser.global_handlers.onerror",+ ),+ ),+ ).toBe(true);+ });+it("drops an intentional request cancellation (AbortError)", () => {expect(isDenylistedNoiseEvent(@@ -845,6 +899,41 @@ describe("isDenylistedNoiseEvent", () => {).toBe(false);});+ it("keeps a non-media NotSupportedError (WebGL / WebRTC / etc.)", () => {+ expect(+ isDenylistedNoiseEvent(+ exceptionEvent(+ "The operation is not supported.",+ "NotSupportedError",+ ),+ ),+ ).toBe(false);+ });++ it("keeps an app-captured NotSupportedError even with the media wording", () => {+ // captureException / generic mechanism is our code reporting a real+ // failure. Only the browser global handler shape is dropped.+ expect(+ isDenylistedNoiseEvent(+ exceptionEvent(+ "The media resource indicated by the src attribute or assigned media provider object was not suitable.",+ "NotSupportedError",+ ),+ ),+ ).toBe(false);+ });++ it("keeps a TypeError that merely quotes the media wording", () => {+ expect(+ isDenylistedNoiseEvent(+ exceptionEvent(+ "The media resource indicated by the src attribute or assigned media provider object was not suitable.",+ "TypeError",+ ),+ ),+ ).toBe(false);+ });+it("keeps the generic prod error-boundary string (LANGFUSE-1MY, deliberately not dropped)", () => {expect(isDenylistedNoiseEvent(diff --git a/web/src/utils/sentryFilters.ts b/web/src/utils/sentryFilters.tsindex 3877cfa47c..3e20642b02 100644--- a/web/src/utils/sentryFilters.ts+++ b/web/src/utils/sentryFilters.ts@@ -301,8 +301,9 @@ export function isReactDevtoolsInternalEvent(event: ErrorEvent): boolean {/*** True for known-benign CLIENT-side noise that cannot be a real Langfuse app* bug: browser-level network/transport failures, transient framework/vendor- * poll logs, and expected browser-permission / cancellation artifacts. Returning- * `true` drops the event in `beforeSend`.+ * poll logs, expected browser-permission / cancellation artifacts, and+ * native HTMLMediaElement codec failures. Returning `true` drops the event+ * in `beforeSend`.** Design rule (safety first): only signatures that CANNOT represent a real app* error are listed, each keyed on an unambiguous signature (whole-message match,@@ -408,6 +409,25 @@ export function isDenylistedNoiseEvent(event: ErrorEvent): boolean {return true;}+ // Browser cannot decode an <audio>/<video> resource (codec missing, empty+ // source list). Firefox and Chromium reject HTMLMediaElement resource+ // selection / autoplay as an unhandled NotSupportedError with no app+ // stack. Onboarding splash videos and inline media players already hide+ // or fall back in the UI; this is an expected capability gap, not an+ // application bug. Guarded to the global handler so an app-captured+ // NotSupportedError with the same wording is KEPT. Other+ // NotSupportedError families (WebGL, WebRTC, "The operation is not+ // supported.") have different messages and are KEPT.+ if (+ isGlobalHandlerUnsupportedMediaResourceEvent(+ exceptionType,+ exceptionValue,+ exception?.mechanism?.type,+ )+ ) {+ return true;+ }+// Known-benign non-Error promise rejections. The `UnhandledRejection`// exception type is SDK-synthesized (a real `Error` rejection keeps its own// type, e.g. `TypeError`), and the value denylist is exact/prefix-anchored:@@ -499,6 +519,37 @@ export function isDenylistedNoiseEvent(event: ErrorEvent): boolean {return false;}+/**+ * Exact browser-generated HTMLMediaElement messages. Whole-string match only:+ * an app error that quotes a phrase is longer and is therefore KEPT.+ */+const UNSUPPORTED_MEDIA_RESOURCE_MESSAGES: readonly string[] = [+ // Firefox+ "The media resource indicated by the src attribute or assigned media provider object was not suitable.",+ // Chromium / WebKit+ "Failed to load because no supported source was found.",+];++/**+ * True for a native HTMLMediaElement NotSupportedError delivered by the+ * browser global handlers (`onunhandledrejection` / `onerror`). See the+ * call site in {@link isDenylistedNoiseEvent} for why this is dropped.+ */+function isGlobalHandlerUnsupportedMediaResourceEvent(+ exceptionType: string | undefined,+ exceptionValue: string,+ mechanismType: string | undefined,+): boolean {+ if (exceptionType !== "NotSupportedError") return false;+ if (+ typeof mechanismType !== "string" ||+ !mechanismType.startsWith("auto.browser.global_handlers")+ ) {+ return false;+ }+ return UNSUPPORTED_MEDIA_RESOURCE_MESSAGES.includes(exceptionValue);+}+/*** Fingerprint used to collapse all stale-chunk parse errors into ONE Sentry* issue (see {@link isStaleChunkParseErrorEvent}).