Repository navigation
fix(error-tracking): init the Next.js browser SDK at the top level of instrumentation-client.ts - #443
Merged
Conversation
🧙 Wizard CIRun the Wizard CI and test your changes against wizard-workbench example apps by replying with a GitHub comment using one of the following commands: Test all apps:
Test all apps in a directory:
Test an individual app:
Show more apps
Test against a wizard branch:
Add Results will be posted here when complete. |
hpouillot
reviewed
Oct 28, 2026
Contributor
Author
|
@hpouillot this was AI generated and I haven't yet manually checked the code. I didn't realize agent created this PR in a "ready" state |
ablaszkiewicz
force-pushed
the
fix/nextjs-error-tracking-coverage
branch
from
October 28, 2026 10:08
ae7f5a8 to
d10bcfa
Compare
ablaszkiewicz
marked this pull request as draft
October 28, 2026 10:20
ablaszkiewicz
force-pushed
the
fix/nextjs-error-tracking-coverage
branch
from
October 28, 2026 10:26
d10bcfa to
cf761bd
Compare
ablaszkiewicz
marked this pull request as ready for review
October 28, 2026 10:28
hpouillot
approved these changes
Oct 28, 2026
… instrumentation-client.ts Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ablaszkiewicz
force-pushed
the
fix/nextjs-error-tracking-coverage
branch
from
October 28, 2026 11:25
cf761bd to
92f8b6a
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.
Problem
wizard error-trackingon a Next.js app with no PostHog putposthog.initinside an exportedregister()ininstrumentation-client.ts. Next.js never calls that export, so the browser SDK never started and no browser error reached PostHog. The build passed, so the verify task didn't catch it.Changes
A Next.js rule in
context/commandments.yaml: callposthog.initat the top level ofinstrumentation-client.ts, with the missing-configuration guard as a top-level if/else around it.Test plan
npm test(220 passing)wizard error-trackingwith this branch (--local-context-mill) on four workbench Next.js apps without PostHog. Every run completed, and each putposthog.initat the top level:error-tracking/no-posthog-next(Next.js 16, App Router)src/appbasic-integration/next-js/15-app-router-saas(Next.js 15, App Router)basic-integration/next-js/15-pages-router-saas(Next.js 15, Pages Router)next start, then loaded in headless Chrome, where a browser error tagged with a marker was thrown. The browser SDK sent requests and the marked$exceptionreached PostHog in all four.export function register()sends no request to PostHog and no exception arrives.The two SaaS apps need their own database and Stripe settings to build, so they built with placeholder values, and
15-app-router-saasrenders/pricingper request instead of prerendering it with a call to Stripe.🤖 Generated with Claude Code