The frontend is loading but API calls are failing. This is likely due to:
- Backend not fully started - Render free tier can take 30-60 seconds to spin up
- GEMINI_API_KEY not set - Check Render environment variables
- CORS issues - Already configured, but verify
Added /health endpoint to verify backend is alive:
@app.get("/health")
async def health_check():
return {
"status": "alive",
"gemini_configured": bool(GEMINI_API_KEY),
"haunt_level": haunt_level
}Frontend now checks if backend is ready before starting heartbeat:
async function checkBackendHealth() {
const response = await fetch('/health');
// Returns true if backend is alive
}- First heartbeat now waits 10 seconds after page load
- If backend not ready, retries after 30 seconds
- Prevents "Failed to fetch" spam
In Render dashboard:
- Go to your service
- Click "Logs" tab
- Look for:
✅ Gemini AI configured INFO: Uvicorn running on http://0.0.0.0:10000 INFO: Application startup complete
Visit: https://dead-web.onrender.com/health
Expected response:
{
"status": "alive",
"gemini_configured": true,
"haunt_level": 1
}If you get 404: Backend isn't running If you get timeout: Service is spinning up (wait 60 seconds)
In Render dashboard:
- Go to Environment tab
- Verify
GEMINI_API_KEYis set - Value should start with
AIzaSy...(your actual key)
Open DevTools (F12) and look for:
✅ Good:
✅ Backend is alive: {status: "alive", ...}
💓 Central heartbeat activated
❌ Bad:
❌ Backend health check failed
⚠️ Backend not ready, will retry in 30 seconds
Cause: Render free tier spins down after 15 min of inactivity
Solution: Wait 30-60 seconds for service to wake up
Prevention: Upgrade to paid tier ($7/month) for always-on
Cause: GEMINI_API_KEY not set in Render
Solution:
- Go to Render dashboard → Environment
- Add variable:
- Key:
GEMINI_API_KEY - Value:
[YOUR_GEMINI_API_KEY_HERE]
- Key:
- Click "Save Changes"
- Service will auto-redeploy
Cause: CORS not configured for production domain
Solution: Already fixed - CORS allows all origins (*)
Cause: Paths incorrect
Solution: Already fixed - using /static/ prefix
-
Spins down after 15 min of inactivity
- First request takes 30-60 seconds to wake up
- Subsequent requests are fast
-
750 hours/month limit
- Enough for testing/demos
- Not suitable for 24/7 production
-
No persistent storage
- Haunt level resets on restart
- No file uploads persist
- Visit your site:
https://dead-web.onrender.com - Wait 60 seconds
- Hard refresh (Ctrl+F5)
- Check console for "✅ Backend is alive"
- Go to Render dashboard
- Check logs for errors
- Look for "Application startup complete"
# Run backend locally
python backend/main.py
# Visit http://localhost:8000
# Should work perfectlyWhen deployment is working, you should see:
✅ Page loads with boot screen
✅ CSS and JS load correctly
✅ Console shows "✅ Backend is alive"
✅ Console shows "💓 Central heartbeat activated"
✅ No "Failed to fetch" errors
✅ AI responses work after 30-60 seconds
If after 5 minutes it's still failing:
- Check Render build logs - Look for Python errors
- Verify requirements.txt - All dependencies installed?
- Check file structure - Is
frontend/folder present? - Test health endpoint - Does
/healthreturn 200?
Share the Render logs and I can help debug further!