2026-02-27

Better Changelog Deployment Progress

Auth Strategy Change

  • Reverted to embedded Clerk auth β€” Sign-in/sign-up now use <SignIn> and <SignUp> components instead of Account Portal redirect
  • Switched to test Clerk keys β€” Using pk_test/sk_test in Vercel production to bypass cross-subdomain session issues
  • Root cause: Clerk satellite domain config between accounts.someshovels.com and changelog.someshovels.com wasn’t working correctly

Current State

  • Working routes: / (200), /sign-in (200), /sign-up (200), /changelog (200)
  • Failing route: /dashboard β€” Server-side exception (Digest: 684590147) due to Clerk subdomain auth issues
  • Forced production deploy in progress with test Clerk keys

Files Modified

  • apps/web/src/app/(auth)/sign-in/[[...sign-in]]/page.tsx β€” Embedded <SignIn> component
  • apps/web/src/app/(auth)/sign-up/[[...sign-up]]/page.tsx β€” Embedded <SignUp> component

Next Steps

  1. Verify deployment completes
  2. Test dashboard with test Clerk keys
  3. Fix Clerk satellite config properly later

Technical Notes

  • Edge env vars: Use APP_DOMAIN (not NEXT_PUBLIC_APP_DOMAIN) for middleware β€” NEXT_PUBLIC_ not available in edge runtime
  • Hardcoded domains: changelog.someshovels.com explicitly in middleware to avoid env var issues
  • Demo tenant: slug=β€œdemo”, id=β€œ3bb57554-12f0-4d81-865f-f7e3607bdef8”

Key Decisions

  • Keep test Clerk keys until functionality confirmed, then fix satellite config
  • TEXT IDs in Prisma schema (not UUID) β€” all migrations aligned

Root cause found: getCurrentMember() in /tmp/better_changelog/apps/web/src/lib/auth.ts was calling setActiveTenantId(tenantId) which writes a cookie.

The problem: Next.js server components can only READ cookies, not WRITE them. The dashboard layout is a server component that calls getCurrentMember(), which was trying to write β†’ crash.

Fix applied: Removed await setActiveTenantId(tenantId) call from getCurrentMember(). Cookies should only be set via explicit tenant-switch actions (e.g., user selecting a different workspace).

User context:

  • Adam’s Clerk ID: user_398ntOqR1NDv9OjCLgeL6fMnVUJ
  • Adam’s local user ID: 15b72b23-771f-480f-a709-b80450c7756c
  • Demo tenant: slug=β€œdemo”, id=β€œ3bb57554-12f0-4d81-865f-f7e3607bdef8”

Files Modified Today

  • /tmp/better_changelog/apps/web/src/lib/auth.ts β€” Removed cookie write from getCurrentMember()
  • /tmp/better_changelog/apps/web/src/app/api/health/route.ts β€” Added for debugging auth chain
  • Dashboard error handling improved with graceful error page