Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

fix(sentry): filter out invalid href errors in event reporting (#9741)

marliessophie2e5fc5bc45b8
diff --git a/web/instrumentation-client.ts b/web/instrumentation-client.ts
index 884e8400c2..4cc406e85b 100644
--- a/web/instrumentation-client.ts
+++ b/web/instrumentation-client.ts
@@ -12,6 +12,7 @@ Sentry.init({
beforeSend(event, hint) {
const error = hint.originalException;
+ const errorValue = event.exception?.values?.[0]?.value || "";
// Filter out TRPCClientErrors, we track them in DataDog.
// The users see those via toast notifications -> see handleTrpcError in web/src/utils/api.ts
@@ -34,6 +35,15 @@ Sentry.init({
return null;
}
+ // Filter invalid href errors - these are from user-inputted data containing malformed URLs
+ // The Next.js router correctly rejects them, no need to log as errors
+ if (
+ errorValue.includes("Invalid href") &&
+ errorValue.includes("passed to next/router")
+ ) {
+ return null;
+ }
+
return event;
},