devlikeapro / waha

WAHA - WhatsApp HTTP API (REST API) that you can configure in a click! Two engines: chromium-based WEBJS and pure-websocket NOWEB
https://waha.devlike.pro/
Apache License 2.0
878 stars 273 forks source link

[BUG][WEBJS] - Unable to Reply to a message - Error: Evaluation failed: TypeError: Cannot read properties of undefined (reading 'unsafe')\n at window.WWebJS.sendMessage #155

Open ehussain opened 1 year ago

ehussain commented 1 year ago

Hello,

We are sending following request to /reply end point and it throws 500 exception and does not send a message.

JSON

{"chatId":"972547293074@c.us","session":"60107","type":"text","text":"\u05e9\u05dc\u05d5\u05dd \u05d5\u05d1\u05e8\u05db\u05d4.  \u05e0\u05d9\u05ea\u05df \u05dc\u05e7\u05d1\u05d5\u05e2 \u05d1\u05d8\u05dc\u05e4\u05d5\u05df: 026426583. \u05d0\u05d5 \u05d1\u05de\u05d9\u05d9\u05dc: drlavie35@gmail.com. \u05e8\u05e4\u05d5\u05d0\u05d4 \u05e9\u05dc\u05d9\u05de\u05d4","reply_to":"false_972547293074@c.us_3A58812051D368F25110"} 

Response

{"statusCode":500,"timestamp":"2023-08-01T12:31:30.901Z","exception":{"stack":"Error: Evaluation failed: TypeError: Cannot read properties of undefined (reading 'unsafe')\n    at window.WWebJS.sendMessage (__puppeteer_evaluation_script__:39:67)\n    at __puppeteer_evaluation_script__:10:45\n    at ExecutionContext._evaluateInternal (/app/node_modules/whatsapp-web.js/node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:221:19)\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n    at async ExecutionContext.evaluate (/app/node_modules/whatsapp-web.js/node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:110:16)\n    at async Client.sendMessage (/app/node_modules/whatsapp-web.js/src/Client.js:815:28)\n    at async /app/node_modules/@nestjs/core/router/router-execution-context.js:46:28\n    at async /app/node_modules/@nestjs/core/router/router-proxy.js:9:17","message":"Evaluation failed: TypeError: Cannot read properties of undefined (reading 'unsafe')\n    at window.WWebJS.sendMessage (__puppeteer_evaluation_script__:39:67)\n    at __puppeteer_evaluation_script__:10:45","name":"Error"},"request":{"path":"/api/reply","method":"POST","body":{"chatId":"972547293074@c.us","session":"60107","type":"text","text":"שלום וברכה.  ניתן לקבוע בטלפון: 026426583. או במייל: drlavie35@gmail.com. רפואה שלימה","reply_to":"false_972547293074@c.us_3A58812051D368F25110"},"query":{}},"version":{"version":"2023.7.16","tier":"PLUS","browser":"/usr/bin/chromium"}}

patron:ADVANCED

allburov commented 1 year ago

Does it happen with recent messages or with old one? With echo bot it works but may be because the message is in client cache...

The quick fix would be to fallback to usual message if you see 500 for POST /reply.

ehussain commented 1 year ago

This happens to normal message also. not only /reply end point.

Please fix it, it is happening with several instances now.

devlikepro commented 1 week ago

Hm, is it happening yet? There was huge update in web (whatsapp official one) and the engine, I see the issue is here for a year...

patron:PRO