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
1.02k stars 310 forks source link

[BUG][WEBJS] - api/sendImage to Channel issue #507

Open sukhcha-in opened 3 months ago

sukhcha-in commented 3 months ago

Some of the requests fail when hitting api/sendImage to send image to a whatsapp channel.

Version

{
  "version": "2024.8.3",
  "engine": "WEBJS",
  "tier": "PLUS",
  "browser": "/usr/bin/chromium"
}

Logs

[06:29:16.423] INFO (30): request errored {"reqId":1482,"req":{"id":1482,"method":"POST","url":"/api/sendImage","query":{},"params":{"0":"api/sendImage"}},"res":{"statusCode":500},"responseTime":571}
    err: {
      "type": "Error",
      "message": "Evaluation failed: b",
      "stack":
          Error: Evaluation failed: b
              at ExecutionContext._ExecutionContext_evaluate (/app/node_modules/whatsapp-web.js/node_modules/puppeteer-core/lib/cjs/puppeteer/common/ExecutionContext.js:229:15)
              at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
              at async ExecutionContext.evaluate (/app/node_modules/whatsapp-web.js/node_modules/puppeteer-core/lib/cjs/puppeteer/common/ExecutionContext.js:107:16)
              at async WebjsClient.sendMessage (/app/node_modules/whatsapp-web.js/src/Client.js:952:25)
    }

patron:PLUS

devlikepro commented 3 months ago

Hi! Could you try to "/logout" from a session and scan it again? Just had the similar issue wit that and logout/login helped

If it doesn't help - could your provide engine field from GET /api/sessions/{name} response :pray: It has the WA web version we need to check

patron:PRO

devlikepro commented 3 months ago

Another thing to try it to switch to chrome-based docker image

devlikeapro/waha-plus:chrome

https://waha.devlike.pro/docs/how-to/engines/#docker-images

basiclly stop and remove old container and run a new one

docker stop waha
docker rm waha
docker run .... devlikeapro/waha-plus:chrome

Kindly use docker run ... with your own parameters https://waha.devlike.pro/docs/how-to/install/

patron:PRO

sukhcha-in commented 3 months ago

@devlikepro I've switched to chrome engine and did a logout and login. Will wait and see if the issue still presists. /api/sessions/{name}:

"engine": {
    "engine": "WEBJS",
    "WWebVersion": "2.3000.1015732531",
    "state": "CONNECTED"
  }

/api/version:

{
  "version": "2024.8.3",
  "engine": "WEBJS",
  "tier": "PLUS",
  "browser": "/usr/bin/google-chrome-stable"
}

patron:PLUS

sukhcha-in commented 3 months ago

@devlikepro The issue still presists and now I've switched to NOWEB engine. I only need to send messages to my Whatsapp channel. I think NOWEB should be fine in this case.

patron:PLUS

sukhcha-in commented 3 months ago

@devlikepro NOWEB is working fine but this issue must be fixed for WEBJS users as well.

patron:PLUS

devlikepro commented 3 months ago

@sukhcha-in thank you for the update! Could you give the payload example for your case? May be it's the image itself causes the issue You can send it to waha@devlike.pro if it's smthg private

patron:PRO

gr8tushar commented 2 days ago

Hi, I am having the same issue in 2024.8.3. Using Webjs engine.

exception":{"stack":"Error: Evaluation failed: b\n at ExecutionContext._ExecutionContext_evaluate (/app/node_modules/whatsapp-web.js/node_modules/puppeteer-core/lib/cjs/puppeteer/common/ExecutionContext.js:229:15)\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-core/lib/cjs/puppeteer/common/ExecutionContext.js:107:16)\n at async WebjsClient.sendMessage (/app/node_modules/whatsapp-web.js/src/Client.js:952:25)","message":"Evaluation failed: b","name":"Error"},"request":{"path":"/api/sendImage","method":"POST","body":{"session":"FA5A7FF56AA04912B68E1C506A9F6EA4","chatId":"91xxxxxxxxxx@c.us","file":{"mimetype":"image/png","url":"http://s3.a.......jpeg","filename":"image.jpg"},"caption":"Hi Bulbul,\n\nHappy Birthday!\n\nWishing you a day filled with joy, laughter, and all the things that make you happiest. May this year bring you new adventures, wonderful memories, and endless reasons to smile. Enjoy every moment of your special day!\n\n"},"query":{}},"version":{"version":"2024.8.3","engine":"WEBJS","tier":"PLUS","browser":"/usr/bin/chromium"}}