From 92f8b6a6beb37bf7690c507003abbe7e26b3d402 Mon Sep 17 00:00:00 2001 From: ablaszkiewicz Date: Wed, 28 Oct 2026 10:55:22 +0100 Subject: [PATCH] fix(error-tracking): init the Next.js browser SDK at the top level of instrumentation-client.ts Co-Authored-By: Claude Opus 5.5 --- context/commandments.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/context/commandments.yaml b/context/commandments.yaml index 6325aea3..3de471c3 100644 --- a/context/commandments.yaml +++ b/context/commandments.yaml @@ -29,6 +29,7 @@ commandments: nextjs: # Initialization - For Next.js 15.3+, initialize PostHog in instrumentation-client.ts for the simplest setup + - Call posthog.init at the top level of instrumentation-client.ts. Next.js runs that file once for its side effects and reads only its onRouterTransitionStart export, so an init inside an exported register() or any other function never runs. Write the missing-configuration guard as a top-level if/else around the init nextjs-feature-flags: # Client-side feature flags