- ✅ Added detailed logging to the unlock endpoint
- ✅ Added error handling in the frontend API client
- ✅ Verified API key is loaded correctly (NVM_API_KEY is SET)
- ✅ Verified Nevermined middleware shows as "ready" in health check
Open your browser's Developer Tools (F12) and check the Console tab when clicking "Unlock with Nevermined". Look for:
🔓 Unlocking lead: <lead_id>- Frontend is calling the API✅ Unlock response:- API call succeeded❌ Unlock error:- API call failed (check the error details)
When you click the unlock button, the server should log:
🔓 Unlock request received for lead_id: <id>
Payment method: nevermined
Lead found, buyability_score: <score>
✅ Lead is protected, processing payment...
Payment result: success=True
✅ Payment successful, returning access token
- Cause: Lead ID doesn't match what's in the store
- Fix: Check that the lead was processed and stored correctly
- Cause: Buyability score < 80
- Fix: Need a lead with score >= 80 to test unlock
- Cause: Frontend can't reach backend
- Fix: Check API_BASE_URL in frontend/.env.local
- Cause: Backend server not running
- Fix: Start the server:
python api/run_server.py
# Get a lead ID first
curl http://localhost:8000/api/leads | python -m json.tool
# Test unlock (replace <lead_id> with actual ID)
curl -X POST http://localhost:8000/api/unlock \
-H "Content-Type: application/json" \
-d '{"lead_id": "<lead_id>", "payment_method": "nevermined"}'cd /Users/oabolade/agents_app_build/lead_sniper_ai
source venv/bin/activate
python -c "import os; from dotenv import load_dotenv; load_dotenv(); print('NVM_API_KEY:', 'SET' if os.getenv('NVM_API_KEY') else 'MISSING')"- User clicks "🔓 Unlock with Nevermined" button
- Frontend calls
POST /api/unlockwithlead_id - Backend checks if lead exists and is protected (score >= 80)
- Backend processes payment via Nevermined middleware
- Backend returns
access_tokenif successful - Frontend uses
access_tokento fetch full lead details - Frontend displays unlocked content
- Check browser console for errors
- Check server logs for unlock requests
- Verify you have a lead with score >= 80
- Test the endpoint directly with curl
- Restart the server if API key was recently added
Share:
- Browser console errors
- Server log output
- Lead ID you're trying to unlock
- Buyability score of the lead