whatsapp-http-api icon indicating copy to clipboard operation
whatsapp-http-api copied to clipboard

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

Open ehussain opened this issue 1 year ago • 3 comments

Hello,

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

JSON

{"chatId":"[email protected]","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: [email protected]. \u05e8\u05e4\u05d5\u05d0\u05d4 \u05e9\u05dc\u05d9\u05de\u05d4","reply_to":"[email protected]_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":"[email protected]","session":"60107","type":"text","text":"שלום וברכה.  ניתן לקבוע בטלפון: 026426583. או במייל: [email protected]. רפואה שלימה","reply_to":"[email protected]_3A58812051D368F25110"},"query":{}},"version":{"version":"2023.7.16","tier":"PLUS","browser":"/usr/bin/chromium"}}

patron:ADVANCED

ehussain avatar Aug 01 '23 12:08 ehussain

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.

allburov avatar Aug 06 '23 15:08 allburov

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

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

ehussain avatar Aug 07 '23 04:08 ehussain

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

devlikepro avatar Aug 18 '24 08:08 devlikepro