Use this playbook to resolve the most common issues when running PluginMind.
๐ Authentication Issues
"Authentication required" (401)
- Ensure the frontend sends requests through
/api/proxy/...withcredentials: 'include'. - Confirm
pm_sessioncookie exists in the browser (Application โ Cookies in devtools). - Re-run the bind flow:
POST /api/proxy/auth/googlewith headerx-use-id-token: true.
Session works locally but not in production
- Check
ENVIRONMENT=productionso cookies areSecure. - Set
SESSION_COOKIE_DOMAIN=.yourdomain.comif backend and frontend are on different subdomains.
๐ง AI Service Failures
/process returns 502 or "External AI service temporarily unavailable"
- Verify
OPENAI_API_KEYandGROK_API_KEYare set. - Hit
/servicesto ensure both services show up. - Restart the backend to re-register services if environment variables changed.
Async job stuck in processing_openai
- Inspect logs for errors from
background_tasks.process_analysis_background. - Pull job details using
GET /analyze-async/{job_id}to seejob.error.
๐๏ธ Database Problems
"no such table"
- Run
alembic upgrade headafter configuringDATABASE_URL. - For SQLite in development, delete
pluginmind_backend/test.dband restart the server.
Readiness probe fails with DB error
- Check connection string credentials.
- Ensure the Postgres service is reachable from the backend container.
๐ฆ Rate Limiting
Frequent 429 responses
- Increase
RATE_LIMIT_PER_MINandRATE_LIMIT_IP_PER_MINfor heavy loads. - Inspect access logs to confirm traffic pattern; bots often hammer the same endpoint.
- If testing locally, lower concurrency or add test-specific overrides.
๐งช Test Failures
ModuleNotFoundError: No module named 'app'
- Make sure you are running pytest from
pluginmind_backend/. - Verify
tests/conftest.pycontains the path injection patch (already included in this repo).
JWT tests hitting Google APIs
- The suite mocks
id_token.verify_oauth2_token; if you changed imports, update the mock path.
๐ก๏ธ Security Checks
Cookie not set
- Confirm the proxy adds
x-use-id-token: trueheader on bind. - Ensure clocks between frontend and backend are in sync (JWT expiration is strict).
Logs contain PII
- Sanitisation is enforced, but if you add new log statements, avoid embedding emails or tokens.
๐งญ Resources
/health,/ready,/servicesโ quick health indicators.scripts/smoke_backend.shโ CLI smoke test after deploy.docs2/guides/security-hardening.mdโ security best practices.
Stay calm and debug on! ๐