Known Errors - EML Backend
1. Introduction
This document details the most common errors in EML Backend, along with their possible causes and recommended solutions. These errors have been extracted directly from the source code and logs generated in the system.
2. System Log Files Overview
Below are the main log files generated in EML Backend, along with their purpose and example contents.
| Log File | Description |
|---|---|
logs/error.log | Records critical errors that affect backend operation. |
logs/access.log | Contains a log of all incoming API requests. |
logs/db.log | Captures queries and database-related errors. |
logs/messaging.log | Records message-sending events, including errors. |
logs/notifications.log | Contains information about sent notifications. |
logs/calls.log | Captures call details, connections, and WebRTC or SIP failures. |
Example entry in logs/error.log:
[2025-03-03T12:45:00Z] ERROR: Database connection failed - ECONNREFUSED
3. List of Known Errors
🔹 3.1 Error: ECONNREFUSED when connecting to the database
Description:
This error occurs when the backend cannot connect to the database.
Possible Causes:
- The database is not running.
- Incorrect credentials in the
.envfile. - Firewall blocking the connection.
Solution:
- Verify that the database is running:
sudo systemctl status mongod # For MongoDB
sudo systemctl status postgresql # For PostgreSQL - Check credentials in the
.envfile. - Try a manual connection:
mongo --host localhost --port 27017
🔹 3.2 Error: 500 Internal Server Error in the API
Error messages detected in logs:
UnhandledPromiseRejectionWarning: TypeError: Cannot read property '...' of undefinedError: Cannot set headers after they are sent to the client
Possible Causes:
- Unhandled exception in the code.
- Missing Node.js dependency.
- Database migration issue.
Solution:
- Review error logs:
tail -f logs/error.log - Ensure all dependencies are installed:
npm install - If using TypeORM, apply migrations:
npm run typeorm migration:run
🔹 3.3 Error: Failed to send message in the messaging module
Error messages detected:
Error: Message sending failed - Invalid API KeyError: Message queue overloaded
Possible Causes:
- Invalid API Key for WhatsApp or SMS.
- Connection issue with the provider (e.g., 360dialog, Twilio).
- The database has messages stuck in
pendingstatus.
Solution:
- Check provider connection:
curl -X GET "https://waba.360dialog.io/v1/status" -H "D360-API-KEY: your_api_key" - Check pending messages in the database:
mongo
> db.messages.find({ status: "pending" }) - Restart the messaging service:
npm run restart:messaging
4. Conclusion
This document has been updated with error messages detected in the backend code and system logs. It is recommended to keep this document updated as new errors are identified in EML Backend. To report a new error, use the internal ticketing system.
🚀 Last updated: 2025