Troubleshooting
Resolve common PULSE issues
Troubleshooting
Solutions for common PULSE problems.
Deployment Issues
”Database not found” Error
Error: Database not found: pulse_analytics
Solution:
-
Check database exists:
wrangler d1 list -
Verify
wrangler.tomlhas correct database_id:[[d1_databases]] binding = "DB" database_id = "YOUR_DATABASE_ID" -
If still failing, recreate:
wrangler d1 create pulse_analytics
“Unauthorized” After Deploy
Error: 401 Unauthorized
Solution:
-
Verify API secret is set:
wrangler secret list --env production -
If missing, set it:
wrangler secret put API_SECRET --env production -
Re-deploy:
npm run deploy:blue
Event Ingestion Issues
Events Not Being Recorded
Check:
-
API authentication:
curl https://api.example.com/api/v1/auth \ -H "Authorization: Bearer YOUR_API_KEY" -
Event payload is valid:
curl -X POST https://api.example.com/collect \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{"site_id":"site_abc123","event_type":"test","timestamp":'$(date +%s000)',"session_id":"test"}' -
Check database is accessible:
curl https://api.example.com/health/ready
Rate Limiting Errors
{
"success": false,
"error": "Rate limit exceeded"
}
Solution:
- Wait 60 seconds and retry
- Batch events together
- Increase rate limit in wrangler.toml
Query Issues
”Site not found” in Queries
Solution:
-
Verify site_id exists:
# Send test event to create site implicitly curl -X POST https://api.example.com/collect \ -H "Authorization: Bearer YOUR_API_KEY" \ -d '{"site_id":"site_abc123",...}' -
Use same site_id in queries:
curl "https://api.example.com/api/v1/stats?site_id=site_abc123&metric=event_count" \ -H "Authorization: Bearer YOUR_API_KEY"
Queries Return No Data
Check:
- Wait 5-10 seconds for event processing
- Verify events were sent
- Check time range includes events
- Verify event timestamps are in milliseconds
Performance Issues
High API Latency
Error: Request timeout (>30 seconds)
Solutions:
-
Check KV cache hit rate:
- Target: >80%
- If <80%: Increase TTL or cache more queries
-
Check database load:
- Verify indexes exist
- Analyze slow queries
-
Reduce query complexity:
- Smaller date ranges
- Fewer aggregations
- More specific filters
WebSocket Disconnections
Check:
-
Browser console for error messages
-
Verify WebSocket upgrade succeeds:
curl -i -N -H "Connection: Upgrade" \ -H "Upgrade: websocket" \ https://api.example.com/api/v1/stats/stream -
Check Cloudflare timeout (30s idle)
Database Issues
D1 Connection Errors
Error: D1 database connection failed
Solution:
- Verify database binding in wrangler.toml
- Check D1 status in Cloudflare dashboard
- Restart worker:
npm run deploy:blue
Migration Failures
Error: Migration 022 failed: syntax error
Solution:
-
Check migration SQL is valid:
sqlite3 db.sqlite < migrations/022.sql -
Review migration for dialect issues
-
Rollback if needed:
npm run deploy:rollback
Monitoring Issues
Datadog Not Receiving Metrics
Check:
-
Verify API key is set:
wrangler secret list --env production -
Check environment variable:
[vars] DATADOG_SITE = "datadoghq.com" -
Verify metrics are being generated:
wrangler tail # Check logs for metrics
Support
If issues persist:
-
Check Logs:
wrangler tail --env production -
Review Cloudflare Status:
-
Community Support:
- GitHub Issues: https://github.com/tesorosocial/pulse/issues
Next Steps
- Compliance — GDPR and compliance
- Monitoring — Set up observability
Last updated: April 3, 2026