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
970 stars 293 forks source link

[BUG][WEBJS] - sendVideo - Constant Timeout #599

Open CautionSentry opened 1 day ago

CautionSentry commented 1 day ago

Describe the bug

I am using n8n + waha, I am trying to send a video via /api/sendVideo and the waha integration sendVideo but I get timeout errors. Even using using Swagger portal I am still facing the issue.

Version

Get the WAHA version by calling GET /api/version

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

Steps

To Reproduce Steps to reproduce the behavior:

  1. Use sendVideo api
  2. Attach parameters required
  3. Timeout error after a while or evaluation eror

FYI File sizes even smaller ones like 5mb fail to be sent

Expected behavior

I am expecting that the video would be sent successfully

Requests - Responses

Request testing on SWAGGER

curl -X 'POST' \
  'https://*********/api/sendVideo' \
  -H 'accept: */*' \
  -H 'X-Api-Key:  ' \
  -H 'Content-Type: application/json' \
  -d '{
  "chatId": "******@c.us",
  "file": {
    "mimetype": "video/mp4",
    "filename": "video.mp4",
    "url": "**********9030d1fbe43e"
  },
  "reply_to": null,
  "asNote": false,
  "caption": "Just watch at this!",
  "session": "default"
}'

Response Testing on Swagger

{
  "statusCode": 500,
  "timestamp": "2024-10-20T13:14:15.288Z",
  "exception": {
    "stack": "Error: Evaluation failed: a\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:105: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:956:25)",
    "message": "Evaluation failed: a",
    "name": "Error"
  },
  "request": {
    "path": "/api/sendVideo",
    "method": "POST",
    "body": {
      "chatId": "*************@c.us",
      "file": {
        "mimetype": "video/mp4",
        "filename": "video.mp4",
        "url": "********9030d1fbe43e"
      },
      "reply_to": null,
      "asNote": false,
      "caption": "Just watch at this!",
      "session": "default"
    },
    "query": {}
  },
  "version": {
    "version": "2024.10.8",
    "engine": "WEBJS",
    "tier": "PLUS",
    "browser": "/usr/bin/google-chrome-stable"
  }
}

Response on N8N :

Ps. Request, Response, and Docker logs are from the Swagger testing and not N8N image

Docker Logs

[17:14:15.289] INFO (1): request errored {"reqId":12,"req":{"id":12,"method":"POST","url":"/api/sendVideo","query":{},"params":{"0":"api/sendVideo"}},"res":{"statusCode":500},"responseTime":204}
    err: {
      "type": "Error",
      "message": "Evaluation failed: a",
      "stack":
          Error: Evaluation failed: a
              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:105: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:956:25)
    }

Additional context

When accessing the url that is being sent to WAHA directly from my browser, the mp4 gets downloaded and played fine

patron:PLUS

devlikepro commented 1 day ago

Could you try with example file via swagger? https://waha.devlike.pro/docs/how-to/send-messages/#send-file-imagesversionspluspng

{
  "chatId": "11111111111@c.us",
  "file": {
    "mimetype": "video/mp4",
    "filename": "video.mp4",
    "url": "https://github.com/devlikeapro/waha/raw/core/examples/video.mp4"
  },
  "caption": "Just watch at this!",
  "session": "default"
}

👉 Please make sure your file has mp4 using libx264 format (the example is in the right format already)

ffmpeg -i input_video.mp4 -c:v libx264 output_video.mp4

patron:PRO

devlikepro commented 1 day ago

If the example works - please attach your file to test with

patron:PRO