waha icon indicating copy to clipboard operation
waha copied to clipboard

[NOWEB] - Intermittent Error When Sending ListMessages on WhatsApp

Open DelBuiTechCorporation opened this issue 8 months ago • 2 comments

Bug Report: Intermittent Error When Sending ListMessages on WhatsApp

Describe the bug

When sending a ListMessage via an external API integrated with WAHA (engine: NOWEB), the behavior is inconsistent: sometimes the message is successfully sent, but at other times WAHA throws an error in the logs.

The error message:

TypeError: Cannot read properties of undefined (reading 'protocolMessage')

It seems that during the message processing, WAHA tries to access a protocolMessage property on an undefined object, leading to a crash in some cases.

This happens intermittently, even when the payload and flow are exactly the same.


Version

[
  {
    "version": "2025.4.1",
    "engine": "NOWEB",
    "tier": "PLUS",
    "browser": null
  }
]

Steps to reproduce

  1. Send a ListMessage using an external API that integrates with WAHA.
  2. Observe the behavior: sometimes it succeeds, sometimes an error is logged.
  3. Check Docker logs when the error occurs.

Expected behavior

The ListMessage should always be processed and delivered correctly without throwing any errors, regardless of the message content (assuming it is valid).


Logs

Relevant excerpt from the Docker logs:

TypeError: Cannot read properties of undefined (reading 'protocolMessage')
    at /app/dist/core/engines/noweb/session.noweb.core.js:1142:43
    at /app/node_modules/rxjs/dist/cjs/internal/operators/filter.js:9:120
    at OperatorSubscriber._this._next (/app/node_modules/rxjs/dist/cjs/internal/operators/OperatorSubscriber.js:33:21)
    at Subscriber.next (/app/node_modules/rxjs/dist/cjs/internal/Subscriber.js:51:18)
    ...

Full log snippet (truncated for clarity):

{
  "level":50,
  "time":1745946286333,
  "pid":1,
  "hostname":"1c403dc69a1b",
  "reqId":1417,
  "session":"551597503084",
  "name":"WhatsappSession",
  "err":{
    "type":"TypeError",
    "message":"Cannot read properties of undefined (reading 'protocolMessage')",
    "stack":"TypeError: Cannot read properties of undefined (reading 'protocolMessage')\n at /app/dist/core/engines/noweb/session.noweb.core.js:1142:43 ..."
  },
  "msg":"TypeError: Cannot read properties of undefined (reading 'protocolMessage') ..."
}

Additional context

  • The error only happens when sending ListMessage types.
  • It does not happen consistently — about 50% of the attempts fail.
  • Payloads seem valid, and no significant differences were noticed between successful and failed attempts.
  • Possibly, certain responses from WhatsApp are missing the protocolMessage field and this is not being handled safely in WAHA's code.

DelBuiTechCorporation avatar Apr 29 '25 17:04 DelBuiTechCorporation

Hi! we'll fix it in the next version, thank you for the details!

One more thing we'd love to ask to investigate the issue with ListMessages - send us engine.event for that message 🙏

Could you do the following

  1. Open Dashboard/Event Monitor (like http://localhost:3000/dashboard/event-monitor/)
  2. Select all events (by default it doesn't listen to engine.event
  3. Send a list message to the number
  4. Copy the incoming engine.event for that message
  5. Send it to [email protected] or here (you can remove personal info) 🙏

That will help us understand why not all messages have message part, that's weird actually

patron:PRO

devlikepro avatar Apr 30 '25 02:04 devlikepro

{ "id": "evt_01jt3hq5w4rreqszfvcjrws9k8", "session": "session", "event": "engine.event", "payload": { "event": "messages.upsert", "data": { "messages": [ { "key": { "remoteJid": "[email protected]", "fromMe": true, "id": "3EB0D5A4D0259DB238F39B2B5D9B8CC59F1DB219" }, "messageTimestamp": 1746023448, "pushName": "Name", "broadcast": false, "status": 3, "messageStubType": 2, "messageStubParameters": [ "Message absent from node" ] } ], "type": "notify" } }, "timestamp": 1746023454596, "metadata": {}, "me": { "id": "[email protected]", "pushName": "Name" }, "engine": "NOWEB", "environment": { "version": "2025.4.1", "engine": "NOWEB", "tier": "PLUS", "browser": null } }

would that be it? Sometimes it works and sometimes it doesn't, as I told you, today it's ok

DelBuiTechCorporation avatar Apr 30 '25 14:04 DelBuiTechCorporation

Fixed in 2025.4.2

patron:PRO

devlikepro avatar May 05 '25 06:05 devlikepro