fix: Resolve IPv4/IPv6 connection issues in News Engine Console
- Backend: Downgrade Pydantic from v2 to v1.10.13 for compatibility - Backend: Fix ObjectId to string conversion in user service - Backend: Update config to use pydantic BaseSettings (v1 import) - Frontend: Downgrade ESLint packages for compatibility - Frontend: Configure Vite proxy to use 127.0.0.1 instead of localhost - Frontend: Set API client to use direct backend URL (127.0.0.1:8101) - Frontend: Add package-lock.json for dependency locking This resolves MongoDB connection issues and frontend-backend communication problems caused by localhost resolving to IPv6. Verified: Login and dashboard functionality working correctly. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
from pydantic_settings import BaseSettings
|
||||
from pydantic import BaseSettings
|
||||
from typing import List
|
||||
|
||||
class Settings(BaseSettings):
|
||||
|
||||
@ -77,6 +77,7 @@ class UserService:
|
||||
"""Get a user by email"""
|
||||
doc = await self.collection.find_one({"email": email})
|
||||
if doc:
|
||||
doc["_id"] = str(doc["_id"]) # Convert ObjectId to string
|
||||
return User(**doc)
|
||||
return None
|
||||
|
||||
@ -118,7 +119,7 @@ class UserService:
|
||||
}
|
||||
|
||||
result = await self.collection.insert_one(user_dict)
|
||||
user_dict["_id"] = result.inserted_id
|
||||
user_dict["_id"] = str(result.inserted_id) # Convert ObjectId to string
|
||||
|
||||
return User(**user_dict)
|
||||
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
fastapi==0.104.1
|
||||
uvicorn[standard]==0.24.0
|
||||
motor==3.3.2
|
||||
pydantic==2.5.0
|
||||
pydantic-settings==2.1.0
|
||||
pydantic==1.10.13
|
||||
pydantic[email]==1.10.13
|
||||
python-jose[cryptography]==3.3.0
|
||||
passlib[bcrypt]==1.7.4
|
||||
python-multipart==0.0.6
|
||||
|
||||
4744
services/news-engine-console/frontend/package-lock.json
generated
Normal file
4744
services/news-engine-console/frontend/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -27,10 +27,10 @@
|
||||
"devDependencies": {
|
||||
"@types/react": "^18.3.10",
|
||||
"@types/react-dom": "^18.3.0",
|
||||
"@typescript-eslint/eslint-plugin": "^8.8.0",
|
||||
"@typescript-eslint/parser": "^8.8.0",
|
||||
"@typescript-eslint/eslint-plugin": "^7.18.0",
|
||||
"@typescript-eslint/parser": "^7.18.0",
|
||||
"@vitejs/plugin-react": "^4.3.2",
|
||||
"eslint": "^9.11.1",
|
||||
"eslint": "^8.57.1",
|
||||
"eslint-plugin-react-hooks": "^4.6.2",
|
||||
"eslint-plugin-react-refresh": "^0.4.12",
|
||||
"typescript": "^5.6.2",
|
||||
|
||||
@ -3,7 +3,7 @@ import type { ApiError } from '@/types'
|
||||
|
||||
// Create axios instance with default config
|
||||
const apiClient: AxiosInstance = axios.create({
|
||||
baseURL: import.meta.env.VITE_API_URL || 'http://localhost:8101',
|
||||
baseURL: 'http://127.0.0.1:8101', // Direct backend URL (bypassing Vite proxy for testing)
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
@ -42,7 +42,7 @@ apiClient.interceptors.response.use(
|
||||
|
||||
// Try to refresh the token
|
||||
const response = await axios.post(
|
||||
`${import.meta.env.VITE_API_URL || 'http://localhost:8101'}/api/v1/users/refresh`,
|
||||
'/api/v1/users/refresh',
|
||||
{ refresh_token: refreshToken }
|
||||
)
|
||||
|
||||
|
||||
@ -21,7 +21,7 @@ export default defineConfig({
|
||||
port: 3000,
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: process.env.VITE_API_URL || 'http://localhost:8101',
|
||||
target: process.env.VITE_API_URL || 'http://127.0.0.1:8101',
|
||||
changeOrigin: true,
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user