Repository navigation
[CI] (c212e50) next-js/15-pages-router-saas - #4324
Closed
wizard-ci-bot[bot] wants to merge 1 commit into
Closed
wizard-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. Client-side setup uses
Confidence score: 4/5 👍
File changes
App sanity check
|
| Criteria | Result | Description |
|---|---|---|
| App builds and runs | No | OpenTelemetry packages at ^0.222.0 do not exist on npm — npm install will fail |
| Preserves existing env vars & configs | Yes | Existing env vars and configs preserved, PostHog additions are additive |
| No syntax or type errors | Yes | All TypeScript/JSX syntax is valid |
| Correct imports/exports | Yes | All import statements reference correct modules and packages |
| Minimal, focused changes | Yes | All changes are PostHog-related with no unrelated modifications |
| Pre-existing issues | None | No pre-existing issues observed in the changed files |
Issues
- Invalid OpenTelemetry package versions:
@opentelemetry/api-logs,@opentelemetry/exporter-logs-otlp-http, and@opentelemetry/sdk-logsare specified at^0.222.0, which does not exist on npm. Current stable versions are in the0.5xrange. Fix by updating to valid versions (e.g.,^0.57.0), or better yet, replace withposthog-nodefor server-side event capture. [CRITICAL]
Other completed criteria
- Environment variables documented in
.env.example .gitignoreupdated to exclude.envposthog-jsadded at valid version^1.435.6- Changes are focused and minimal
PostHog implementation ⚠️
| Criteria | Result | Description |
|---|---|---|
| PostHog SDKs installed | Yes | posthog-js added to package.json at ^1.435.6 |
| PostHog client initialized | Yes | Initialized in _app.tsx with typeof window guard, env vars for token/host, defaults: '2026-01-30' |
| capture() | Yes | Multiple meaningful capture calls: checkout_started, user_signed_in, user_signed_up, account_updated, team_invitation_sent, team_member_removed, subscription_management_opened, user_signed_out |
| identify() | Yes | posthog.identify(String(user.id), { email, name, role }) called on app load and after login; uses stable numeric user ID |
| Error tracking | Yes | Custom ErrorBoundary component with posthog.captureException(error), plus capture_exceptions: true in init config |
| Reverse proxy | No | No rewrites in next.config.ts; PostHog requests go directly to the PostHog host |
Issues
- No reverse proxy: The
next.config.tscontains no rewrites for proxying PostHog requests. This means client-side requests are susceptible to ad blockers. Add Next.js rewrites or use the PostHog managed reverse proxy. [MEDIUM] - Server-side uses OTLP logs, not PostHog events: The three API routes use
logPostHogIntegration()which sends OpenTelemetry logs, not standardposthog.capture()events. These logs won't integrate into PostHog funnels or activity feeds the same way. Consider usingposthog-nodefor proper server-side event capture. [MEDIUM]
Other completed criteria
- API key loaded from
NEXT_PUBLIC_POSTHOG_PROJECT_TOKENenvironment variable - API host loaded from
NEXT_PUBLIC_POSTHOG_HOSTenvironment variable posthog.reset()called on sign-out- Identify uses stable numeric user ID (
String(user.id)) — not email - Identify called both on page load (for returning users) and on login
- Error boundary wraps the entire app in
_app.tsx
PostHog insights and events ✅
| Filename | PostHog events | Description |
|---|---|---|
components/login.tsx |
user_signed_in, user_signed_up |
Captures authentication events after successful login/signup |
components/header.tsx |
user_signed_out |
Captures sign-out with posthog.reset() to clear identity |
pages/pricing.tsx |
checkout_started |
Captures checkout initiation with plan_name and billing_interval properties |
pages/dashboard/index.tsx |
subscription_management_opened, team_member_removed, team_invitation_sent |
Captures team and subscription management actions |
pages/dashboard/general.tsx |
account_updated |
Captures account profile updates |
components/error-boundary.tsx |
captureException |
Captures React rendering errors with component stack trace |
pages/_app.tsx |
identify |
Identifies authenticated users on app load |
pages/api/account/update.ts |
OTLP log: account_updated |
Server-side log (not standard PostHog event) |
pages/api/stripe/create-checkout.ts |
OTLP log: checkout_session_created |
Server-side log (not standard PostHog event) |
pages/api/team/invite.ts |
OTLP log: team_invitation_created |
Server-side log (not standard PostHog event) |
Issues
- Duplicated
checkout_startedcapture: Inpricing.tsx, the sameposthog.capture('checkout_started', ...)call appears in both theresult.redirectToandresult.urlbranches. Extract to a single call before the conditional. [LOW]
Other completed criteria
- Events represent real user actions (sign-in, checkout, team management)
- Events enable product insights — can build sign-up → checkout funnel, track team collaboration
- Events include relevant properties (
plan_name,billing_interval,role,component_stack) - No PII in event properties — email/name only in
identify()person properties - Consistent snake_case naming convention throughout
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: wizard-pr
Trigger ID:
c212e50App:
next-js/15-pages-router-saasApp directory:
apps/next-js/15-pages-router-saasWorkbench branch:
wizard-ci-c212e50-next-js-15-pages-router-saasWizard branch:
posthog/functional-r9-19-bring-docs-readmes-and-skills-in-line-wiContext Mill branch:
mainPostHog (MCP) branch:
masterTimestamp: 2026-10-01T19:37:16.290Z
Duration: 505.5s
YARA Scanner