December 12th, 2025
The Day Convex Finally Said “Functions Ready” Today was a marathon debugging session. We created our own Convex project, fought with environment variables, discovered the component architecture, and finally got that beautiful green checkmark.Creating Our Own Convex Project
Why We Needed a Fresh Start
We were using Atheeq’s old Convex deployment, which caused:- Mixed environment variables
- Wrong deployment IDs
- Inherited misconfigurations
- Permission confusion
The New Project Details
Created a new Convex project called “CommitT” under our own team:.cloudURL → Used for calling backend functions (mutations, queries, database operations).siteURL → Used ONLY for authentication (OAuth redirects, sessions, login callbacks)
The Environment Variable Journey
Understanding the ENV Structure
We learned that Convex has a specific ENV structure across different parts of the monorepo: Backend (packages/backend/.env.local):
apps/native/.env):
apps/web/.env):
The Big Discovery: Convex ENV Registration
We discovered that Convex does NOT automatically load.env files. You must explicitly register environment variables using the CLI:
SITE_URL = undefined in our logs.
The HTTP Router Nightmare
The Error Chain
We went through multiple errors trying to get the HTTP router working:route requires handler- auth.handlers was undefinedconvex/http not found- wrong import pathhttpAction not exported- wrong Convex version APIdefault export is not a Router- mixing old and new APIs
The Root Cause
We were mixing THREE incompatible generations of Convex HTTP APIs:- Legacy (≤1.29): default request handler
- Intermediate (1.30): httpAction
- New Router API (≥1.31): httpRouter
The Real Fix: Component Architecture
The breakthrough came when we found the correct documentation. Convex + BetterAuth uses a component-based architecture, not manual auth.ts + http.ts.The Correct Architecture
Required Files
convex.config.ts
auth.config.ts
http.ts (The Correct Version)
authComponent.registerRoutes() instead of manually mounting routes.
The Victory Moment
After hours of debugging, we finally saw:- Convex project is valid
- BetterAuth component is mounted correctly
- HTTP routes are registered
- Cloud accepted our build
The Final Error: Invalid Callback URL
When we tested Google login, we got:trustedOrigins list.
What We Learned Today
- Convex ENV registration is manual - You must use
npx convex env setto register variables - Component architecture is required - Manual auth.ts + http.ts doesn’t work with new Convex
- convex.config.ts is mandatory - Without it, BetterAuth component won’t register
- authComponent.registerRoutes() - This is the correct way to mount auth routes
- Version mismatches cause chaos - Local vs cloud Convex versions must align
- trustedOrigins must include Expo URLs - For mobile OAuth to work
What’s Left for Tomorrow
- Set up Google OAuth callback URLs properly
- Add Expo URLs to trustedOrigins
- Configure Google Cloud Console redirect URIs
- Test the complete OAuth flow
- Actually understand the auth flow instead of vibe coding it
Summary
Today was brutal but educational. We went from:- Mixed deployments and 404 errors
- To understanding the complete Convex + BetterAuth architecture
- To finally seeing “Convex functions ready!”