The 404 errors for API routes were caused by:
- Syntax Error in password-reset.ts: Incorrect URL configuration with malformed string concatenation ✅ FIXED
- Next.js Cache: Stale build cache preventing routes from being recognized ✅ CLEARED
- 500 Errors on Transcribe/Upload: Missing content-type validation ✅ FIXED
All API routes are now properly configured:
/api/health- Health check endpoint/api/auth/password-reset- Password reset (was 404, now fixed)/api/auth/verify-email- Email verification/api/auth/change-email- Email change/api/extract-memories- Memory extraction (was 404, now fixed)/api/tts- Text-to-speech (was 404, now fixed)/api/generate-image- Image generation/api/generate-video- Video generation/api/web-search- Web search/api/chat-direct- Direct chat/api/chat-direct-personality- Personality chat/api/test-chat- Test chat/api/profile- User profile/api/storage/cleanup- Storage cleanup/api/debug/errors- Debug errors/api/debug/providers- Debug providers
/api/transcribe- Audio transcription (now validates content-type)/api/upload-image- Image upload (now validates content-type)
Before:
await sendPasswordResetEmail(auth, email, {
url: `${process.env.NEXT_PUBLIC_APP_URL ||'https://codeex-ai.netlify.app','http://localhost:3000'}/login`,
handleCodeInApp: true,
});After:
const redirectUrl = process.env.NEXT_PUBLIC_APP_URL ||
process.env.NEXT_PUBLIC_SITE_URL ||
'http://localhost:3000';
await sendPasswordResetEmail(auth, email, {
url: `${redirectUrl}/login`,
handleCodeInApp: true,
});Removed .next directory to force rebuild of all routes.
Both /api/transcribe and /api/upload-image now properly validate that requests use multipart/form-data content type, preventing 500 errors when called incorrectly.
scripts/clear-cache.ps1(Windows PowerShell)scripts/clear-cache.sh(Linux/Mac)
scripts/test-api-routes.js- Tests all API endpoints- Skips routes that require file uploads (transcribe, upload-image)
Important: Make sure your dev server is running first!
# Start dev server in one terminal
npm run dev
# In another terminal, run tests
npm run test:apiAll three routes are now properly configured:
- Method: POST
- Body:
{ email: string } - Purpose: Send password reset email
- Status: ✅ Fixed
- Method: POST
- Body:
{ userMessage: string, assistantResponse: string, userId: string } - Purpose: Extract and store conversation memories
- Status: ✅ Working (returns success when disabled)
- Method: POST/GET
- Body:
{ text: string, voice?: string, speed?: number } - Purpose: Convert text to speech using Groq PlayAI
- Status: ✅ Working
The TTS error Speech error: interrupted is not a bug. It occurs when:
- User clicks the speak button again while audio is playing (stops playback)
- User navigates away from the page while audio is playing
- Browser stops audio playback for any reason
This is expected behavior and not an error that needs fixing.
- Restart your dev server after clearing cache
- Test the routes using the test script
- Verify in browser that the 404 errors are gone
To prevent cache issues in the future:
- Clear cache when adding new API routes
- Restart dev server after major changes
- Use the test script to verify routes after changes
src/lib/password-reset.ts- Fixed URL syntax errorscripts/clear-cache.ps1- New cache clearing scriptscripts/clear-cache.sh- New cache clearing scriptscripts/test-api-routes.js- New API testing script