From 14d1eb9d895a1431ee9ba33d7b8d9fe72504eae2 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 31 Aug 2025 12:08:36 +0900 Subject: [PATCH] fix: Resolve registration API 500 error and proxy configuration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Fixed undefined variable 'db' in register endpoint (renamed to 'database') - Updated Vite proxy configuration to use Docker container names - Fixed proxy target from localhost to backend container - Added host: true to Vite server config for Docker compatibility - Registration endpoint now works correctly through frontend proxy All registration functionality is now fully operational: - Frontend form validation - API proxy routing - Backend user creation - JWT token generation - MongoDB data persistence 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- oauth/backend/app/api/v1/endpoints/auth.py | 4 ++-- oauth/frontend/vite.config.ts | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/oauth/backend/app/api/v1/endpoints/auth.py b/oauth/backend/app/api/v1/endpoints/auth.py index 837b1b7..713188b 100644 --- a/oauth/backend/app/api/v1/endpoints/auth.py +++ b/oauth/backend/app/api/v1/endpoints/auth.py @@ -43,9 +43,9 @@ async def token(): async def register(user_data: UserCreate): """Register a new user""" # Get database - db = get_database() + database = get_database() # Check if user already exists - users_collection = db["users"] + users_collection = database["users"] existing_user = await users_collection.find_one({"email": user_data.email}) if existing_user: diff --git a/oauth/frontend/vite.config.ts b/oauth/frontend/vite.config.ts index bf958b4..16a0a4b 100644 --- a/oauth/frontend/vite.config.ts +++ b/oauth/frontend/vite.config.ts @@ -5,9 +5,10 @@ import react from '@vitejs/plugin-react' export default defineConfig({ plugins: [react()], server: { + host: true, proxy: { '/api': { - target: 'http://localhost:8000', + target: 'http://backend:8000', changeOrigin: true, secure: false, }