Skip to content

[CI] (c212e50) next-js/15-pages-router-saas - #4324

Closed
wizard-ci-bot[bot] wants to merge 1 commit into
mainfrom
wizard-ci-c212e50-next-js-15-pages-router-saas
Closed

wizard-ci-bot[bot] wants to merge 1 commit into
mainfrom
wizard-ci-c212e50-next-js-15-pages-router-saas

Conversation

@wizard-ci-bot

@wizard-ci-bot wizard-ci-bot Bot commented Oct 1, 2026

Copy link
Copy Markdown

Automated wizard CI run

Source: wizard-pr
Trigger ID: c212e50
App: next-js/15-pages-router-saas
App directory: apps/next-js/15-pages-router-saas
Workbench branch: wizard-ci-c212e50-next-js-15-pages-router-saas
Wizard branch: posthog/functional-r9-19-bring-docs-readmes-and-skills-in-line-wi
Context Mill branch: main
PostHog (MCP) branch: master
Timestamp: 2026-10-01T19:37:16.290Z
Duration: 505.5s

YARA Scanner

✓ 243 tool calls scanned, 0 violations detected

No violations: ✓ 243 clean scans

@wizard-ci-bot

wizard-ci-bot Bot commented Oct 1, 2026

Copy link
Copy Markdown
Author

PR Evaluation Report

Summary

This PR integrates PostHog into a Next.js 15 Pages Router SaaS app. Client-side setup uses posthog-js with initialization in _app.tsx, user identification via /api/user, event captures across login/checkout/team flows, and an error boundary with captureException. Server-side "events" are implemented via OpenTelemetry OTLP log export rather than the standard posthog-node SDK, using package versions that do not exist on npm.

Files changed Lines added Lines removed
14 +234 -9

Confidence score: 4/5 👍

  • Invalid OpenTelemetry package versions: ^0.222.0 does not exist on npm for @opentelemetry/api-logs, @opentelemetry/exporter-logs-otlp-http, or @opentelemetry/sdk-logs. Current versions are in the 0.5x range. npm install will fail, preventing the app from building. [CRITICAL]
  • No reverse proxy configured: next.config.ts has no rewrites. Client-side PostHog requests are sent directly to the PostHog host and are susceptible to ad blockers. [MEDIUM]
  • Server-side events use OTLP logs instead of posthog-node: The logPostHogIntegration function sends OpenTelemetry logs to /i/v1/logs, not standard PostHog events. These will appear as logs, not as first-class events in PostHog's activity feed or funnels, making them far less useful for analytics. [MEDIUM]

File changes

Filename Score Description
pages/_app.tsx 4/5 PostHog init with env vars, identify on load, ErrorBoundary wrapper
components/error-boundary.tsx 4/5 Class-based error boundary with captureException
components/login.tsx 4/5 Identify user on login with stable numeric ID, capture sign-in/sign-up events
components/header.tsx 5/5 Capture sign-out event and call posthog.reset()
pages/pricing.tsx 4/5 Capture checkout_started with plan/interval properties (duplicated code)
pages/dashboard/index.tsx 4/5 Capture subscription, team member, and invitation events
pages/dashboard/general.tsx 4/5 Capture account_updated event
package.json 1/5 Invalid OpenTelemetry versions ^0.222.0 — will fail install
lib/posthog-logs.ts 2/5 Unconventional OTLP log approach instead of posthog-node; depends on broken packages
.env.example 4/5 Documents PostHog env vars correctly
pages/api/account/update.ts 3/5 Uses OTLP logs — functional intent but broken dependency
pages/api/stripe/create-checkout.ts 3/5 Uses OTLP logs — functional intent but broken dependency
pages/api/team/invite.ts 3/5 Uses OTLP logs — functional intent but broken dependency
.gitignore 5/5 Ignores .env file

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-logs are specified at ^0.222.0, which does not exist on npm. Current stable versions are in the 0.5x range. Fix by updating to valid versions (e.g., ^0.57.0), or better yet, replace with posthog-node for server-side event capture. [CRITICAL]

Other completed criteria

  • Environment variables documented in .env.example
  • .gitignore updated to exclude .env
  • posthog-js added 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.ts contains 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 standard posthog.capture() events. These logs won't integrate into PostHog funnels or activity feeds the same way. Consider using posthog-node for proper server-side event capture. [MEDIUM]

Other completed criteria

  • API key loaded from NEXT_PUBLIC_POSTHOG_PROJECT_TOKEN environment variable
  • API host loaded from NEXT_PUBLIC_POSTHOG_HOST environment 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_started capture: In pricing.tsx, the same posthog.capture('checkout_started', ...) call appears in both the result.redirectTo and result.url branches. 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants