waha icon indicating copy to clipboard operation
waha copied to clipboard

[WEBJS] - Unhandled TypeError: Cannot read properties of undefined (reading 'includes')

Open alvaromoura-nibo opened this issue 4 months ago • 7 comments

Describe the bug

Unhandled TypeError: Cannot read properties of undefined (reading 'includes') thrown from parseMessageIdSerialized while processing a message. The crash happens inside toWAMessage → processIncomingMessage in the WEBJS engine: a message reaches parseMessageIdSerialized with an undefined serialized id, so calling .includes() on it throws.

Because it's thrown from the RxJS fromEvent message stream handler, it surfaces as an unhandled error and the message event is not delivered (no webhook fired for it).

Version

{
"version":"2026.5.1",
"engine":"WEBJS",
"tier":"PLUS",
"browser":"/usr/bin/google-chrome",
"platform":"linux/x64","worker":{"id":null}
}

▎ Docker image in use: devlikeapro/waha-plus:chrome-2026.5.1

Will try to update to the latest version before/after reporting.

Steps

To Reproduce Steps to reproduce the behavior:

  1. Start a WEBJS (Plus) session and keep it connected
  2. Send a message
  3. See the error below in the logs (the message event throws while building the WAMessage)

Expected behavior

parseMessageIdSerialized should defensively handle an undefined/missing serialized id (return null / skip) instead of throwing, so sending a message does not crash the processing pipeline with an unhandled TypeError.

Requests - Responses

N/A — I don't have the request/response payload to attach.

Docker Logs

TypeError: Cannot read properties of undefined (reading 'includes') at parseMessageIdSerialized (/app/dist/core/utils/ids.js:9:20) at WhatsappSessionWebJSPlus.toWAMessage (/app/dist/core/engines/webjs/session.webjs.core.js:1329:56) at WhatsappSessionWebJSPlus.processIncomingMessage (/app/dist/core/engines/webjs/session.webjs.core.js:1205:32) at /app/dist/core/engines/webjs/session.webjs.core.js:1100:261 at doInnerSub (/app/node_modules/rxjs/dist/cjs/internal/operators/mergeInternals.js:22:31) at outerNext (/app/node_modules/rxjs/dist/cjs/internal/operators/mergeInternals.js:17:70) 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) at /app/node_modules/rxjs/dist/cjs/internal/operators/filter.js:9:164 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) at WebjsClientPlus.handler (/app/node_modules/rxjs/dist/cjs/internal/observable/fromEvent.js:59:31) at WebjsClientPlus.emit (node:events:520:35) at /app/node_modules/whatsapp-web.js/src/Client.js:451:18 at Binding. (/app/node_modules/whatsapp-web.js/src/util/Puppeteer.js:28:28) at Binding.run (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/Binding.js:132:46)

Additional context

  • Engine: WEBJS Plus (WhatsappSessionWebJSPlus / WebjsClientPlus), Chrome build.
  • The failing call chain is entirely internal to WAHA's WEBJS engine: parseMessageIdSerialized (core/utils/ids.js:9) is invoked from toWAMessage (session.webjs.core.js:1329) during processIncomingMessage (session.webjs.core.js:1205).
  • Root cause appears to be a missing null-guard: parseMessageIdSerialized assumes the serialized id string is always defined and calls .includes() on it. The message being processed arrives without a populated serialized id.

patron:PRO

alvaromoura-nibo avatar Jul 14 '26 21:07 alvaromoura-nibo

Both issues are related with Id parsing. #2157

eduardo-publi avatar Jul 14 '26 21:07 eduardo-publi

+1

patron:PRO

ehussain avatar Jul 15 '26 06:07 ehussain

+1 same here

claudiocnc avatar Jul 15 '26 08:07 claudiocnc

+1 same here

alegobbojt avatar Jul 15 '26 08:07 alegobbojt

maybe this is the related pr on wwebjs https://github.com/wwebjs/whatsapp-web.js/pull/201832

claudiocnc avatar Jul 15 '26 08:07 claudiocnc

+1

patron:PRO

leonardolimafarias avatar Jul 15 '26 11:07 leonardolimafarias

2026.7.1 - WEBJS - Unhandled TypeError: Cannot read properties of undefined (reading 'includes') - #2158

patron:PRO

devlikepro avatar Jul 15 '26 13:07 devlikepro