If you're seeing "Failed to fetch" or "Failed to generate score", it means the frontend cannot connect to the backend API.
Open a terminal and check if the backend is running on port 8000:
# Check if port 8000 is in use
lsof -ti:8000
# OR on Windows:
netstat -ano | findstr :8000If nothing is running, start the backend:
cd backend
source venv/bin/activate # On Windows: venv\Scripts\activate
# Verify environment variables are set
python -c "import os; from dotenv import load_dotenv; load_dotenv(); print('CREDIT_PASSPORT_NFT_ADDRESS:', os.getenv('CREDIT_PASSPORT_NFT_ADDRESS', 'NOT SET'))"
# Start the backend
python -m uvicorn app:app --reload --port 8000You should see:
INFO: Uvicorn running on http://0.0.0.0:8000
INFO: Application startup complete.
Open your browser and go to: http://localhost:8000/health
You should see:
{"status":"healthy","service":"AETHER-SCORE API","version":"1.0.0"}If you get an error, check the backend terminal for error messages.
Check that frontend/.env.local has:
NEXT_PUBLIC_API_URL=http://localhost:8000Or remove the file to use the default (which is now port 8000).
If you made changes, restart the Next.js dev server:
cd frontend
# Stop the current server (Ctrl+C)
npm run devOpen browser DevTools (F12) and check:
- Console tab: Look for any CORS errors or network errors
- Network tab: Check if the request to
http://localhost:8000/api/scoreis being made and what the response is
Solution: The backend requires these environment variables in backend/.env:
CREDIT_PASSPORT_NFT_ADDRESS(orCREDIT_PASSPORT_ADDRESS)BACKEND_PRIVATE_KEYQIE_RPC_URL(orQIE_TESTNET_RPC_URL)
Solution: Ensure backend/.env has:
FRONTEND_URL=http://localhost:3000Solution: Check the error message in the terminal. Common causes:
- Missing environment variables (startup validation will tell you which ones)
- Invalid private key format
- Invalid contract address format
- RPC URL unreachable
Solution:
- Verify backend is actually running:
curl http://localhost:8000/health - Check firewall settings
- Verify no other process is using port 8000
- Backend is running on port 8000
-
http://localhost:8000/healthreturns success -
backend/.envhas all required variables -
frontend/.env.localhasNEXT_PUBLIC_API_URL=http://localhost:8000(or uses default) - Frontend dev server has been restarted after changes
- Browser console shows no CORS errors
- Network tab shows requests to
localhost:8000
- Check backend logs for detailed error messages
- Check browser console for specific error details
- Verify all environment variables are set correctly
- Try accessing the API directly:
curl -X POST http://localhost:8000/api/score -H "Content-Type: application/json" -d '{"address":"0x0000000000000000000000000000000000000000"}'