Troubleshooting
Common issues and their solutions for MediaMagic CRM.
Quick Diagnostics
Run these commands to check system health:
bash
docker compose psbash
docker compose logs -f --tail=100bash
curl http://localhost:3100/healthService Issues
EspoCRM Not Starting
Symptom: EspoCRM container keeps restarting
Check MySQL health:
bash
docker compose logs espocrm-mysqlCommon causes:
- MySQL not ready before EspoCRM starts
- Insufficient permissions on volumes
- Corrupted database
Solution:
bash
# Restart in correct order
docker compose stop espocrm
docker compose up -d espocrm-mysql
sleep 30 # Wait for MySQL
docker compose up -d espocrmSymptom: "Database connection failed"
Check credentials match:
.envfile:MYSQL_PASSWORD- Match between EspoCRM and MySQL containers
Solution:
bash
# Reset with fresh database
docker compose down
docker volume rm crm_mysql-data
docker compose up -dBridge API Issues
Symptom: Bridge container exits immediately
Check logs:
bash
docker compose logs bridgeCommon causes:
- Missing environment variables
- Syntax error in code
- Dependency issues
Solution:
bash
# Rebuild bridge
docker compose build bridge
docker compose up -d bridgeSymptom: Bridge returns 500 errors
Check logs for error details:
bash
docker compose logs bridge --tail=50Common causes:
- EspoCRM API key invalid
- External service down
- Database connection issue
Verify connections:
bash
# From bridge container
docker compose exec bridge sh
curl http://espocrm/api/v1/App/userPostgreSQL Issues
Symptom: Grafana shows "No data"
Check PostgreSQL connection:
bash
docker compose exec postgres psql -U mediamagic -d mediamagic_analytics -c "SELECT 1"Check tables exist:
bash
docker compose exec postgres psql -U mediamagic -d mediamagic_analytics -c "\dt"Re-seed if needed:
bash
docker compose exec -T postgres psql -U mediamagic -d mediamagic_analytics < postgres/seed-data.sqlWebhook Issues
Webhooks Not Firing
Verify webhook configuration in EspoCRM
- Go to Admin → Webhooks
- Check each webhook has:
- URL:
http://bridge:3100/webhooks/{event-name} - Entity Type: Correct entity
- Event: Create, Update, or Delete
- Is Active: Yes
- URL:
Test webhook manually
bash
# Send test webhook
curl -X POST http://localhost:3100/webhooks/test \
-H "Content-Type: application/json" \
-d '{"test": true}'Publishing Issues
Platform Publish Stuck in "Queued"
Check X Server connectivity
bash
# From bridge container
docker compose exec bridge sh
curl $X_SERVER_URL/healthIf not reachable:
- Verify
X_SERVER_URLin.env - Check X Server is running
- Check firewall rules
Check platform routes
Verify platform is in PLATFORM_ROUTES:
javascript
// bridge/routes/webhooks.js
const PLATFORM_ROUTES = {
'YourPlatform': {
livestream: '/yourplatform-create',
upload: '/yourplatform-upload'
},
};Platform Publish Failed
Check error details
- In EspoCRM, open the failed PlatformPublish record
- Check the
apiResponsefield for error details - Common errors:
- Authentication failed: Platform credentials expired
- Rate limited: Too many requests
- Invalid data: Missing required fields
Retry a failed publish
Simply set status back to "Queued":
bash
# Via EspoCRM UI
# Or via API:
curl -X PUT http://localhost:8080/api/v1/PlatformPublish/{id} \
-H "Content-Type: application/json" \
-H "X-Api-Key: YOUR_API_KEY" \
-d '{"status": "Queued"}'Social Post Issues
Posts Not Scheduling
Check Ayrshare connection
bash
# Test Ayrshare API
curl -X GET https://app.ayrshare.com/api/user \
-H "Authorization: Bearer YOUR_AYRSHARE_KEY"If 401 error: API key is invalid or expired.
Check scheduling payload
View what's being sent to Ayrshare:
bash
docker compose logs bridge | grep -i ayrshareEnsure scheduledAt is in the future.
Analytics Not Collecting
Manually trigger collection
bash
curl -X POST http://localhost:3100/analytics/collectCheck response for errors.
Check cron job
The analytics cron runs every 6 hours. Check if it's running:
bash
docker compose logs bridge | grep -i "analytics\|cron"Database Issues
Reset All Data
Warning
This deletes ALL data. Make a backup first!
bash
# Backup first
./backup.sh
# Stop everything
docker compose down
# Remove volumes
docker volume rm crm_mysql-data crm_espocrm-data crm_grafana-data crm_postgres-data
# Start fresh
docker compose up -dRestore from Backup
bash
# Stop services
docker compose down
# Restore volumes from backup
# (depends on backup format)
# Start services
docker compose up -dViewing Logs
All Services
bash
docker compose logs -fSpecific Service
bash
docker compose logs -f bridge
docker compose logs -f espocrm
docker compose logs -f postgres
docker compose logs -f grafanaFilter by Time
bash
# Last hour
docker compose logs --since 1h bridge
# Last 100 lines
docker compose logs --tail 100 bridgeGetting Help
- Check logs — Most issues are visible in container logs
- Check
.env— Many issues are configuration-related - Restart services — Sometimes a restart fixes transient issues
- Check GitHub issues — Someone may have had the same problem
bash
# Quick health check script
echo "=== Service Status ==="
docker compose ps
echo "=== Bridge Health ==="
curl -s http://localhost:3100/health | jq
echo "=== Recent Errors ==="
docker compose logs --tail 20 2>&1 | grep -i "error\|fail\|exception"