Add PostHog client-side error tracking and session replay#258
Merged
jakebromberg merged 1 commit intomainfrom Apr 21, 2026
Merged
Add PostHog client-side error tracking and session replay#258jakebromberg merged 1 commit intomainfrom
jakebromberg merged 1 commit intomainfrom
Conversation
23f9ece to
57297c8
Compare
57297c8 to
c22a56f
Compare
Replace the reverted Sentry integration with PostHog for client-side error tracking, automatic exception capture, session replay, and pageview tracking. Add X-Request-Id header to API requests for cross-service correlation with Backend-Service Sentry traces. - posthog-js with capture_exceptions for window.onerror/unhandledrejection - PostHogProvider wrapping the component tree with pageview tracking - global-error.tsx error boundary capturing render errors to PostHog - RTK Query error middleware reporting API failures to PostHog - X-Request-Id (crypto.randomUUID) on every backend API request - productionBrowserSourceMaps for stack trace resolution
c22a56f to
e5ecc5d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
capture_exceptions, session replay, pageview tracking)posthog.captureException()into RTK Query error middleware with endpoint name/status metadataX-Request-Idheader to all backend API requests for cross-service correlationCloses #257
Test plan
npm run buildsucceedslib/__tests__/posthog.test.ts-- 5 tests pass (init config, default host, no-op without key, no-op on server, skip re-init)/ebatch requests fire$exceptionin PostHog Error TrackingX-Request-Idheader in devtoolsNEXT_PUBLIC_POSTHOG_KEYandNEXT_PUBLIC_POSTHOG_HOSTin Cloudflare Pages secrets