Troubleshooting - teaminfinitydev/laravel-activity-log-discord GitHub Wiki
Connection Issues
If you're experiencing issues connecting to Discord webhooks, try the following solutions:
1. Check Your Webhook URL
Ensure your Discord webhook URL is correctly formatted and valid. It should look like:
https://discord.com/api/webhooks/[webhook_id]/[webhook_token]
2. SSL Certificate Issues
If you receive a "No response from Discord (connection error)" error, you might be having SSL certificate issues, especially in a local development environment.
Temporary Fix (Development Only):
Modify the DiscordWebhookService.php
file to disable SSL verification:
public function __construct(?string $webhookUrl, string $botName = 'Activity Logger', ?string $avatarUrl = null)
{
$this->client = new Client([
'timeout' => 30,
'connect_timeout' => 10,
'verify' => false, // Disable SSL verification for testing
]);
// Rest of the constructor...
}
⚠️ WARNING: Re-enable SSL verification (verify => true
) before deploying to production!
3. Firewall or Network Issues
- Ensure your server/local environment can access external services
- Check if your firewall allows outgoing connections to Discord (ports 443/80)
- Try testing with a different internet connection
4. Detailed Debug Logging
Enable detailed logging to see what's happening with the connection:
try {
// In your DiscordWebhookService.php
Log::debug('Attempting to connect to Discord webhook', [
'webhook_url' => $this->maskWebhookUrl($this->webhookUrl),
]);
$response = $this->client->post($this->webhookUrl, [
// your existing options
'debug' => true, // Add this to see detailed request/response info
]);
} catch (RequestException $e) {
Log::error('Discord webhook error details', [
'request_exception_details' => method_exists($e, 'getHandlerContext') ? $e->getHandlerContext() : 'Not available',
]);
}
Then check your Laravel logs for more information.
🎨 Discord Message Examples
The package sends rich embed messages to Discord that look like this:
User Login Event
🔐 User Login
User [email protected] logged in
Performed by: John Doe ([email protected])
Details:
IP: 192.168.1.100
User Agent: Mozilla/5.0...
Timestamp: 2024-01-15 14:30:22
Application Bootup Event
🚀 System Bootup
Web application started successfully
Details:
Environment: production
PHP Version: 8.2.0
Laravel Version: 10.0.0
Memory Usage: 32.5 MB
Server Time: 2024-01-15 14:30:22
Model Created Event
➕ Model Created
Post 'My First Blog Post' was created
Performed by: Jane Doe ([email protected])
Subject: My First Blog Post
Details:
Title: My First Blog Post
Category: Technology
Status: Published