fix: ignore intentional redirect errors in posthog
Build and Push Image / docker (push) Successful in 5m22s

This commit is contained in:
2026-04-19 00:27:02 +07:00 Unverified
parent effa8eafea
commit 7a7cb285a0
+11
View File
@@ -6,4 +6,15 @@ posthog.init(process.env.NEXT_PUBLIC_POSTHOG_PROJECT_TOKEN!, {
defaults: "2026-01-30",
capture_exceptions: true,
debug: process.env.ENVIRONMENT === "development",
before_send: (event) => {
if (event?.event === "$exception") {
const exceptionList = event.properties.$exception_list || [];
const exception = exceptionList[0];
if (exception?.value === "NEXT_REDIRECT") {
return null; // Drop it entirely
}
}
return event;
},
});