Skip to content

v0.4.3 - DX Improvements from Real Production Feedback

Choose a tag to compare

@lance0lance0 released this 17 Nov 15:00
· 8 commits to master since this release

🎯 DX Improvements Based on Scout Integration

This release addresses critical developer experience issues discovered during real production integration.

✨ New Helper Functions

Better TypeScript Support:

  • requireServerSession() - Get authenticated session or throw (no more ! assertions)
  • isLatchSession() - Type guard for proper TypeScript narrowing
  • checkLatchHealth() - Configuration validation for health check endpoints

🐛 Critical Fixes

Next.js 16 Compatibility:

  • ❌ Fixed: export const runtime = 'nodejs' causes build errors in proxy.ts
  • ✅ proxy.ts automatically uses Node.js runtime (no config needed)

Session Validation:

  • ❌ Fixed: Examples checking session.idToken (property doesn't exist)
  • ✅ Check session.sub instead (from ID token claims)

📚 Documentation

New Reference Implementation:

  • examples/nextjs16/proxy.ts - Complete Next.js 16 proxy with proper session validation

Enhanced API_REFERENCE.md:

  • Clear LatchSession/LatchUser structure documentation
  • ✅ Correct vs ❌ Wrong usage examples
  • Cookie name constants documentation
  • Session validation patterns for proxy.ts

🧪 Testing

  • Added 17 new tests for DX helpers
  • All 182 tests passing
  • No breaking changes

📦 What Changed

Added:

  • requireServerSession() helper
  • isLatchSession() type guard
  • checkLatchHealth() config validator
  • Reference proxy.ts for Next.js 16
  • Comprehensive session documentation

Fixed:

  • Next.js 16 proxy.ts runtime export issue
  • Session validation patterns in examples
  • Documentation clarity on session structure

🙏 Credits

Based on real production feedback from integrating Latch into Scout app. Thanks for the 2.5 hours of pain points that made this release possible!

📖 Links