2026-02-28

Better Changelog - FINALLY WORKING! πŸŽ‰

Issues Fixed Tonight

  1. Missing autoprefixer dependency - Next.js build failed
  2. Missing marketing route pages - Created stub pages for /features, /pricing, /docs, /demo
  3. typedRoutes experiment too strict - Disabled (caused type errors on dynamic routes)
  4. Next.js CVE-2025-66478 - Upgraded to 16.1.6 (Vercel blocked vulnerable versions)
  5. Env vars with trailing newlines - Broke middleware domain comparison, re-added cleanly
  6. Clerk auth.protect() incompatible with Next.js 16 - Changed to explicit redirect
  7. Cookie write in server component - setActiveTenantId() called in getCurrentMember() threw error; removed (cookies can only be read in RSC, not written)
  8. Missing database tables - entry_audiences and entry_product_areas weren’t migrated to Neon DB

Root Cause Analysis

The main blocker was DB schema drift - the Drizzle schema defined junction tables that were never actually created in Neon. The query in getEntriesForDashboard() tried to join these tables and threw relation "entry_audiences" does not exist.

Debugging Approach

  • Created /api/health endpoint to test auth chain step-by-step
  • Created /dashboard/test minimal page to isolate which component failed
  • Found queries worked in API routes but crashed in server components
  • Eventually traced to missing DB tables via health check error messages

Final State

  • URL: https://changelog.someshovels.com βœ…
  • Sign-in/Sign-up: Working
  • Dashboard: Working (shows empty entries, ready to create first changelog)
  • Next.js version: 16.1.6
  • Clerk version: 6.38.3

DB Tables Created

CREATE TABLE entry_audiences (
  entry_id TEXT NOT NULL REFERENCES changelog_entries(id) ON DELETE CASCADE,
  audience VARCHAR(50) NOT NULL,
  PRIMARY KEY (entry_id, audience)
);
 
CREATE TABLE entry_product_areas (
  entry_id TEXT NOT NULL REFERENCES changelog_entries(id) ON DELETE CASCADE,
  product_area_id TEXT NOT NULL REFERENCES product_areas(id) ON DELETE CASCADE,
  PRIMARY KEY (entry_id, product_area_id)
);

Git Branch

All fixes on claude/changelog-saas-agent-profiles-4P7vs - needs PR to main