[WEBJS] - GET /api/{session}/chats/{chatId}/messages returns 500 - Cannot read properties of undefined (reading 'waitForChatLoading')
GET /api/{session}/chats/{chatId}/messages intermittently returns a 500 error with TypeError: Cannot read properties of undefined (reading 'waitForChatLoading'). The route works sometimes and fails other times for the same chatId. The error occurs regardless of the chatId format (@c.us or @lid).
Version
Get the WAHA version by calling GET /api/version
{
"version": "2026.3.4",
"engine": "WEBJS",
"tier": "CORE",
"browser": "/usr/bin/chromium",
"platform": "linux/x64"
}
Steps
To Reproduce Steps to reproduce the behavior:
- Start a WAHA session with WEBJS engine
- Call GET /api/default/chats/[email protected]/messages?limit=10
- Sometimes returns messages correctly, sometimes returns 500
Expected behavior
Should consistently return the list of messages for the given chat.
Requests - Responses
Request:
GET /api/default/chats/1234567890%40c.us/messages?sortBy=timestamp&sortOrder=desc&downloadMedia=false&merge=true&limit=10
Response:
{
"statusCode": 500,
"timestamp": "2026-04-08T10:54:26.498Z",
"exception": {
"message": "Cannot read properties of undefined (reading 'waitForChatLoading')",
"name": "TypeError",
"stack": "TypeError: Cannot read properties of undefined (reading 'waitForChatLoading')\n at evaluate (evaluate at WPage.evaluate (/app/dist/core/engines/webjs/WPage.js:13:36))\n at async WebjsClientCore.getMessages (/app/dist/core/engines/webjs/WebjsClientCore.js:171:26)\n at async WhatsappSessionWebJSCore.getChatMessages (/app/dist/core/engines/webjs/session.webjs.core.js:597:26)"
},
"request": {
"path": "/api/default/chats/1234567890%40c.us/messages",
"method": "GET",
"query": {
"sortBy": "timestamp",
"sortOrder": "desc",
"downloadMedia": "false",
"merge": "true",
"limit": "10"
}
},
"version": {
"version": "2026.3.4",
"engine": "WEBJS",
"tier": "CORE",
"browser": "/usr/bin/chromium",
"platform": "linux/x64"
}
}
Docker Logs
N/A
Screenshots
N/A
Additional context
- The error is intermittent — same chatId works sometimes and fails other times
- Occurs with both @c.us and @lid chatId formats
- Tested on versions 2026.3.2 and 2026.3.4, same behavior
- Docker Compose deployment on linux/x64
- Suspected cause: WhatsApp Web internal JS update (r7KAd4T0ZuM.js) changed the internal API making waitForChatLoading intermittently undefined
this pr was opened a while ago on WEBJS project with a possible fix https://github.com/wwebjs/whatsapp-web.js/issues/201706
✅ Ready and available in dev images
Make sure to select the engine via the environment variable - WHATSAPP_DEFAULT_ENGINE=WEBJS:
devlikeapro/waha-plus:devdevlikeapro/waha-plus:dev-chromedevlikeapro/waha-plus:dev-arm
🕛 Note: Dev images are published nightly at 00:00 UTC, so new builds become available right after midnight UTC.
🚀 Will be included in the next release!