Troubleshooting¶
This guide helps you diagnose and resolve common issues with the Notification Server module.
Quick Diagnosis Checklist¶
Start Here for Any Issue
Before diving into specific issues, run through this quick checklist:
- Is Redis running and accessible?
- Is the notification server running and accessible?
- Are the correct URLs configured in Drupal?
- Do the required ports have network connectivity?
- Are the required permissions granted?
Connection Issues¶
Redis Connection Problems¶
Symptoms: - Notification server fails to start - Error messages about Redis connection - Data not persisting between restarts
Diagnosis:
Testing Redis Connectivity
Solutions:
Redis Troubleshooting Steps
-
Start Redis if not running:
-
Check Redis configuration:
-
Fix connection URL:
- Check
REDIS_URLenvironment variable - Ensure hostname/IP is correct
- Verify port number (default: 6379)
Notification Server Connection Issues¶
Symptoms: - HTTP requests to notification server fail - WebSocket connections cannot be established - Drupal module reports connection errors
Diagnosis:
Testing Notification Server Connectivity
Solutions:
-
Start notification server:
-
Check server logs:
-
Verify environment variables:
Network Connectivity Issues¶
Symptoms: - Drupal can't reach notification server - WebSocket connections time out - Intermittent connectivity problems
Diagnosis:
# Test network connectivity from Drupal server
curl -v http://notification-server-host:3000/health
# Check firewall rules
sudo ufw status
sudo iptables -L
# Test WebSocket connectivity
wscat -c ws://notification-server-host:8080
Solutions:
-
Configure firewall:
-
Check Docker networking:
-
Verify DNS resolution:
Configuration Problems¶
Module Not Configured¶
Symptoms: - Error: "Notification server not configured" - No response from notification server - Configuration form shows empty values
Solutions:
Configuration Steps
- Configure server URLs:
- Visit
/admin/config/system/notification-server - Set Server URL:
http://localhost:3000(or your server URL) - Set WebSocket URL:
ws://localhost:8080(or your WebSocket URL) -
Save configuration
-
Verify URL format:
- HTTP URL should include protocol:
http://orhttps:// - WebSocket URL should use
ws://orwss:// -
Include port numbers if not standard (80/443)
-
DDEV specific configuration:
- Use
notification-serveras hostname - Server URL:
http://notification-server:3000 - WebSocket URL:
ws://notification-server:8080
Invalid URLs¶
Symptoms: - WebSocket URL validation errors - "Invalid websocket URL" error message - Configuration form rejects URLs
Solutions:
URL Format Reference
-
Check URL format:
-
Common URL patterns:
Environment Variable Issues¶
Symptoms: - Notification server uses wrong ports - Redis connection fails despite Redis running - CORS errors in browser
Diagnosis:
# Check notification server environment
docker exec notification-server env
# Verify expected variables
docker exec notification-server printenv | grep -E "(PORT|REDIS_URL|CORS_ORIGIN)"
Solutions:
-
Set required environment variables:
-
Restart after environment changes:
Permission Problems¶
Admin Access Issues¶
Symptoms: - Cannot access configuration page - "Access denied" when trying to configure module - Configuration menu items not visible
Solutions:
- Grant required permissions:
- Go to
/admin/people/permissions - Find "Administer notification_server configuration"
-
Grant to appropriate roles
-
Check user roles:
- Ensure user has administrative role
- Verify role has the required permissions
Demo Access Issues¶
Symptoms: - Cannot access demo pages - Demo menu items not visible - "Access denied" on demo URLs
Solutions:
- Grant demo permissions:
access notification_server http demo-
access notification_server websocket demo -
Enable demo module:
Message Delivery Issues¶
Messages Not Publishing¶
Symptoms:
- publishNotification() returns null
- No error messages but messages don't appear
- API calls succeed but clients don't receive messages
Diagnosis:
<?php
// Enable detailed logging
$logger = \Drupal::logger('notification_server');
$logger->info('Testing notification publish');
$result = $notification_client->publishNotification('test', 'Hello');
if ($result === null) {
$logger->error('Publish failed');
} else {
$logger->info('Publish succeeded: @result', ['@result' => json_encode($result)]);
}
Solutions:
-
Check channel existence:
-
Verify server logs:
-
Test with simple message:
WebSocket Messages Not Received¶
Common WebSocket Issue
This is often caused by channel access restrictions or invalid client IDs. Check access permissions first.
Symptoms: - WebSocket connection established - Subscription appears successful - Published messages not received by clients
Diagnosis:
-
Check client ID validity:
-
Verify subscription:
Solutions:
-
Grant channel access:
-
Check subscription format:
-
Monitor WebSocket connection:
Channel Access Issues¶
Symptoms: - Clients cannot subscribe to channels - "Access denied" errors in WebSocket - Subscription attempts fail silently
Solutions:
-
Create channel with public access:
-
Grant specific client access:
-
Use pattern-based access:
Performance Issues¶
Slow Message Delivery¶
Symptoms: - Messages take long time to deliver - High latency in WebSocket communication - Timeouts during API calls
Diagnosis:
# Check Redis performance
redis-cli --latency-history
# Monitor notification server resources
docker stats notification-server
# Check network latency
ping notification-server-host
Solutions:
-
Optimize Redis:
-
Scale notification server:
-
Monitor connection limits:
High Memory Usage¶
Symptoms: - Redis memory usage grows continuously - Out of memory errors - Performance degradation over time
Solutions:
-
Configure Redis memory management:
-
Set message TTL:
-
Monitor and cleanup:
Browser-Specific Issues¶
WebSocket Connection Failures¶
Symptoms: - WebSocket connections fail in specific browsers - CORS errors in browser console - Mixed content warnings
Solutions:
-
Fix CORS configuration:
-
Use secure WebSocket for HTTPS sites:
-
Handle mixed content:
- Use HTTPS for all connections in production
- Configure proper SSL certificates
Logging and Debugging¶
Enable Debug Logging¶
Drupal:
Notification Server:
Redis:
Monitor Logs¶
# Watch Drupal logs
tail -f /var/log/drupal/drupal.log
# Watch notification server logs
docker logs -f notification-server
# Watch Redis logs
docker logs -f redis
# Watch all logs together
docker-compose logs -f
Debug Tools¶
WebSocket Testing:
# Install wscat
npm install -g wscat
# Test WebSocket connection
wscat -c ws://localhost:8080?clientId=test123
HTTP API Testing:
# Test notification publishing
curl -X POST http://localhost:3000/api/notifications \
-H "Content-Type: application/json" \
-d '{"channel":"test","message":"Hello World"}'
Getting Help¶
Collect Debug Information¶
Information to Provide When Seeking Help
When seeking help, provide:
- System information:
- Drupal version
- PHP version
- Module version
-
Operating system
-
Configuration:
- Server URLs
- Environment variables
-
Docker setup (if applicable)
-
Error logs:
- Drupal logs
- Notification server logs
- Browser console errors
-
Redis logs
-
Test results:
- Connectivity tests
- API responses
- WebSocket connection status
Support Channels¶
- Issue Queue: Project Issues
- Notification Server: GitHub Issues
- Community: Drupal Slack channels
Known Issues¶
Check for known issues and workarounds:
- Browser compatibility: Some older browsers may have WebSocket limitations
- Proxy servers: Corporate firewalls may block WebSocket connections
- Container networking: Docker network configuration may require adjustment
- Performance limits: Default configuration is optimized for development, not production