Wasp 0.17.0 Migration Issues & Solutions Summary Context: Migrating from Wasp 0.16.x to 0.17.0 Total Errors Fixed: 18 TypeScript compilation errors (14 context + 4 function signature) Root Causes: Express 5 upgrade + API context type changes + User ID schema change (number → cuid/string) 🔥 Major Issues Encountered: 1. API Context Type Mismatches (14 errors) Problem: APIs with auth: false + entities: [User] caused context errors: Property 'user' is missing in type '{ entities: { User: ... }; }' but required in type 'Context' Root Cause: Wasp generates different context objects based on auth settings, but API implementations expected consistent Context types. Solutions Applied: APIs that actually use context.user → Changed auth: false to auth: true APIs that don't need User access → Removed entities: [User] + updated Context types 2. User ID Type Mismatch (1 error) Problem: Root Cause: User ID changed from number to string (cuid), but API Context types still expected number. Solution: Updated Context type definitions from id: number to id: string 3. Express 5 Function Signature Errors (4 errors) Problem: Root Cause: Wasp calls API functions with (req, res, context) but some implementations only accepted (req, res). Solution: Updated API function signatures to accept the context parameter (even if unused). 🛠️ Specific APIs Fixed: Changed auth: false → auth: true (APIs using context.user): googleOAuth - uses context.user?.id dropboxOAuth - uses context.user?.id oneDriveOAuth - uses context.user?.id oneDriveOAuthCallback - uses context.user Removed entities: [User] (APIs not using User): dropboxThumbnail, oneDriveThumbnail, googleDriveThumbnail voiceAgentProxy, imageEditChat, voiceAgentBrandInfo googleOAuthCallback, dropboxOAuthCallback Fixed User ID Type (number → string): dropboxStoreToken.ts oneDriveOAuthCallback.ts Added Context Parameter: imageEditChat, assetRegenerate, assetVariation, assetGuidedVariation 🚨 Potential Wasp Framework Issues: Code Generation Bug: Generated API routes don't properly handle the auth/entities combinations in 0.17.0 Migration Guide Gap: No clear guidance on handling APIs with mixed auth/entity requirements Type Generation: Context types aren't automatically updated when auth settings change Express 5 Compatibility: Function signature expectations changed but not documented for API endpoints 💡 Recommendations for Wasp Team: Improve Migration Guide: Add section on API context changes and auth/entities combinations Better Error Messages: More specific guidance when context type mismatches occur Auto-Migration Tool: Detect and suggest fixes for common auth/entities patterns Type Safety: Generate Context types dynamically based on auth/entities settings Express 5 Documentation: Clear guidance on API function signature requirements ✅ Final Result: 18 compilation errors → 0 errors All APIs working correctly with proper auth/context handling Express 5 compatibility achieved User ID type consistency maintained This migration required deep understanding of Wasp's internal API generation and Express 5 changes. The issues weren't immediately obvious and required systematic analysis of each API's actual usage patterns vs. their configuration. Time Investment: ~2 hours of systematic debugging Complexity: High - required understanding of Wasp internals, Express 5 changes, and TypeScript type system