[CI] (gpt54-trial) next-js/15-app-router-saas#2401
Closed
wizard-ci-bot[bot] wants to merge 1 commit into
Closed
Conversation
Author
|
Now I have all the context I need. Here's my evaluation: PR Evaluation ReportSummaryThis PR integrates PostHog into a Next.js 15 App Router SaaS app with both client-side (posthog-js via
Confidence score: 3/5 🤔
File changes
App sanity check
|
| Criteria | Result | Description |
|---|---|---|
| App builds and runs | No | posthog.captureException() does not exist on posthog-node — will cause a TypeScript type error or runtime crash in the Stripe checkout error handler |
| Preserves existing env vars & configs | Yes | Existing configs preserved; only PostHog additions made |
| No syntax or type errors | No | captureException is not a valid method on the posthog-node PostHog class |
| Correct imports/exports | Yes | posthog-js used client-side, posthog-node used server-side — correct separation |
| Minimal, focused changes | Yes | All changes directly relate to PostHog integration |
| Pre-existing issues | None | No pre-existing issues observed |
Issues
captureExceptionon posthog-node:posthog.captureException(error)is called on the posthog-node client inapp/api/stripe/checkout/route.ts. This method only exists onposthog-js(browser SDK). The Node SDK should useposthog.capture({ distinctId, event: '', properties: { ... } })or handle errors differently. [CRITICAL].env.examplemissing PostHog vars:NEXT_PUBLIC_POSTHOG_PROJECT_TOKENandNEXT_PUBLIC_POSTHOG_HOSTare required but not documented in.env.example. Collaborators won't know what to set. [MEDIUM]
Other completed criteria
- All changes relate to PostHog integration with no unrelated edits
- Correct files modified for Next.js App Router (instrumentation-client.ts, next.config.ts, layout, server actions, API routes)
- Code follows existing codebase patterns (naming, structure, TypeScript usage)
- Both posthog-js and posthog-node correctly imported from their respective packages
- Build configuration (package.json) is valid with correct dependency additions
PostHog implementation ⚠️
| Criteria | Result | Description |
|---|---|---|
| PostHog SDKs installed | Yes | posthog-js@^1.396.6 and posthog-node@^5.39.4 added to package.json |
| PostHog client initialized | Yes | Client via instrumentation-client.ts with posthog.init(); server via factory function creating new PostHog instance per request with flushAt: 1, flushInterval: 0 |
| capture() | Yes | 12+ meaningful events across client and server |
| identify() | Yes | Client-side via PostHogIdentify component using SWR; server-side in signIn/signUp/updateAccount actions using user.id.toString() |
| Error tracking | No | capture_exceptions: true in client init is correct, but server-side captureException() call on posthog-node is invalid |
| Reverse proxy | Yes | Next.js rewrites correctly configured: /ingest/static/* and /ingest/array/* → us-assets.i.posthog.com, /ingest/* → us.i.posthog.com |
Issues
- Invalid
captureExceptionon server: The Stripe checkout error handler callsposthog.captureException()on the posthog-node client, which doesn't have this method. Useposthog.capture({ distinctId: userId, event: '', properties: { : error.message } })instead. [CRITICAL] - Stripe webhook
distinctIdmismatch:subscription.customer as stringyields a Stripe customer ID (e.g.,cus_xxx), not the app's numeric user ID. These events won't link to the correct PostHog person. Should look up the app user by Stripe customer ID first. [MEDIUM]
Other completed criteria
- API key loaded from environment variable
NEXT_PUBLIC_POSTHOG_PROJECT_TOKEN - Host correctly configured — client uses
/ingestreverse proxy, server usesNEXT_PUBLIC_POSTHOG_HOSTenv var posthog.reset()called on sign-out to unlink future eventsPostHogIdentifycomponent re-identifies on app load (returning users)- Server-side
identify()in signIn/signUp uses real database user IDs skipTrailingSlashRedirect: truecorrectly added for reverse proxy compatibility
PostHog insights and events ⚠️
| Filename | PostHog events | Description |
|---|---|---|
instrumentation-client.ts |
autocapture, ``, captureException (auto) |
Client-side init with error autocapture enabled |
app/(dashboard)/layout.tsx |
identify, reset |
User identification on dashboard load, reset on sign-out |
app/(dashboard)/pricing/submit-button.tsx |
checkout_initiated |
Tracks when user clicks checkout button |
app/(login)/actions.ts |
user_signed_in, user_signed_up, user_signed_out, password_updated, account_deleted, account_updated, team_member_removed, team_member_invited |
Server-side auth and team management events |
app/api/stripe/checkout/route.ts |
subscription_checkout_completed, captureException |
Checkout completion and error tracking (broken) |
app/api/stripe/webhook/route.ts |
subscription_updated, subscription_cancelled |
Stripe webhook subscription lifecycle events |
Issues
- PII in
capture()event properties:emailappears as an event property inuser_signed_in,user_signed_up,user_signed_out, andaccount_deleted.invited_emailappears inteam_member_invited. Email is PII and belongs inidentify()person properties, not incapture()event properties. Removeemailfrom allcapture()calls — the user is already identified viaidentify(). [CRITICAL]
Other completed criteria
- Events represent real user actions mapping to actual SaaS product flows (auth, billing, team management)
- Events enable product insights — can build sign-up → checkout conversion funnel, retention analysis, churn signals from account_deleted/subscription_cancelled
- Events include relevant contextual properties (team_id, plan_name, subscription_status, stripe IDs)
- Event names are descriptive and use consistent snake_case naming convention
Reviewed by wizard workbench PR evaluator
Draft
5 tasks
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:
gpt54-trialApp:
next-js/15-app-router-saasApp directory:
apps/next-js/15-app-router-saasWorkbench branch:
wizard-ci-gpt54-trial-next-js-15-app-router-saasWizard branch:
543fbd70b7d834c9bb2bf5afe28fc0a5761ced5dContext Mill branch:
mainPostHog (MCP) branch:
masterTimestamp: 2026-07-03T16:12:03.982Z
Duration: 486.6s
YARA Scanner