[CI] (gpt5-trial-2) next-js/15-pages-router-saas#2405
Closed
wizard-ci-bot[bot] wants to merge 1 commit into
Closed
[CI] (gpt5-trial-2) next-js/15-pages-router-saas#2405wizard-ci-bot[bot] wants to merge 1 commit into
wizard-ci-bot[bot] wants to merge 1 commit into
Conversation
Author
PR Evaluation ReportSummaryThis PR integrates PostHog into a Next.js 15 Pages Router SaaS app, adding both client-side (
Confidence score: 4/5 👍
File changes
App sanity check
|
| Criteria | Result | Description |
|---|---|---|
| App builds and runs | Yes | No syntax errors; PostHog SDK versions are valid |
| Preserves existing env vars & configs | Yes | Existing code untouched; PostHog additions are additive |
| No syntax or type errors | Yes | TypeScript is valid across all changed files |
| Correct imports/exports | Yes | posthog-js on client, posthog-node on server — correct separation |
| Minimal, focused changes | No | posthog-setup-report.md is unnecessary; report claims sign-up instrumentation that doesn't exist |
| Pre-existing issues | None | Base app appears functional |
Issues
.env.examplenot updated: PostHog env vars (NEXT_PUBLIC_POSTHOG_PROJECT_TOKEN,NEXT_PUBLIC_POSTHOG_HOST,POSTHOG_PROJECT_API_KEY,POSTHOG_HOST) are only in.env.local, not in.env.example. Collaborators won't know what to set. [MEDIUM]- Report claims false coverage:
posthog-setup-report.mdlistsauth_sign_up_attempted,auth_sign_up_succeeded,auth_sign_up_failedevents inpages/api/auth/sign-up.ts, but that file was never modified. [LOW]
Other completed criteria
- App builds without errors introduced by the PR
- Existing app code and configs are preserved
- All import/export statements are correct (posthog-js client-side, posthog-node server-side)
- Build configuration (package.json) is valid
PostHog implementation ⚠️
| Criteria | Result | Description |
|---|---|---|
| PostHog SDKs installed | Yes | posthog-js@^1.396.6 and posthog-node@^5.39.4 in package.json |
| PostHog client initialized | No | instrumentation-client.ts initializes correctly but omits the defaults option recommended by docs |
| capture() | Yes | 14+ meaningful events across client and server |
| identify() | No | Uses raw email as distinct_id (posthog.identify(data.email)); server-side uses user.id.toString() — mismatched identity |
| Error tracking | No | No captureException, no error boundary, no capture_exceptions config |
| Reverse proxy | No | next.config.ts has no PostHog rewrites; client events exposed to ad blockers |
Issues
- Email as
distinct_id:posthog.identify(data.email)inlogin.tsxuses the user's email asdistinct_id. This creates fragmented person profiles since server-side events useuser.id.toString(). Should use a stable user ID from the auth response. [CRITICAL] - Missing
posthog.reset()on logout:header.tsxfiresauth_signed_outbut never callsposthog.reset(). On shared devices, future anonymous events will remain linked to the previous user. [CRITICAL] - No error tracking: No
PostHogErrorBoundary, nocaptureExceptioncalls, andcapture_exceptionsis not set in the init config. [MEDIUM] - No reverse proxy: Full-stack Next.js app has no rewrites configured for PostHog endpoints, making client-side tracking vulnerable to ad blockers. [MEDIUM]
- Missing
defaultsin init:posthog.init()ininstrumentation-client.tsomits thedefaultsoption that PostHog docs recommend for all new integrations. [MEDIUM]
Other completed criteria
- API keys loaded from environment variables (not hardcoded)
- API host correctly configured pointing to
https://us.i.posthog.com - Server-side client uses correct
flushAt: 1andflushInterval: 0pattern for Next.js API routes - Both client and server SDKs properly installed
PostHog insights and events ⚠️
| Filename | PostHog events | Description |
|---|---|---|
components/login.tsx |
auth_sign_in_attempted, auth_sign_up_attempted, auth_sign_in_failed, auth_sign_up_failed, auth_sign_in_succeeded, auth_sign_up_succeeded, auth_flow_error |
Full auth flow tracking with attempt/success/failure states; enables auth conversion funnel |
components/header.tsx |
auth_signed_out |
Tracks user logout (but missing posthog.reset()) |
pages/api/auth/sign-in.ts |
auth_sign_in_failed, auth_sign_in_succeeded |
Server-side auth tracking with failure reasons |
pages/api/stripe/create-checkout.ts |
checkout_session_created |
Tracks checkout creation with redirect context |
pages/api/stripe/webhook.ts |
subscription_updated |
Tracks Stripe subscription changes with status |
pages/api/team/invite.ts |
team_member_invited |
Tracks team invitations with role |
pages/api/team/remove-member.ts |
team_member_removed |
Tracks member removal |
pages/api/account/update.ts |
account_updated |
Tracks profile updates |
pages/dashboard/index.tsx |
billing_portal_opened |
Tracks billing portal access |
pages/pricing.tsx |
checkout_initiated |
Tracks checkout initiation with plan name |
Issues
- Duplicate event names across client/server:
auth_sign_in_failedandauth_sign_in_succeededare captured both client-side (login.tsx) and server-side (sign-in.ts), creating duplicate events for the same action. The client and server use differentdistinct_idvalues (email vs user.id), compounding the problem. [MEDIUM] - Webhook
distinct_iduses Stripe customer ID:subscription_updatedusessubscription.customerasdistinct_id, which is a Stripe ID (e.g.,cus_xxx) that won't match any PostHog person. Should use the team's owner user ID. [MEDIUM]
Other completed criteria
- Events represent real user actions (auth, checkout, billing, team management)
- Events enable product insights (auth conversion funnel, checkout flow, team activity trends)
- Events include relevant contextual properties (reason, team_id, role, plan_name, etc.)
- No PII in capture() event properties — emails and names are not sent as event properties
- Event names are descriptive and use consistent snake_case convention
Reviewed by wizard workbench PR evaluator
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.
Automated wizard CI run
Source: manual
Trigger ID:
gpt5-trial-2App:
next-js/15-pages-router-saasApp directory:
apps/next-js/15-pages-router-saasWorkbench branch:
wizard-ci-gpt5-trial-2-next-js-15-pages-router-saasWizard branch:
1eb16c89a1ac295f0887a96381fff7314e999b05Context Mill branch:
mainPostHog (MCP) branch:
masterTimestamp: 2026-07-03T16:22:43.129Z
Duration: 522.9s
YARA Scanner