waha icon indicating copy to clipboard operation
waha copied to clipboard

[WEBJS] - πŸ› Bug Report: Error 500 when sending an audio file

Open yeiider opened this issue 10 months ago β€’ 2 comments

AquΓ­ tienes el issue en inglΓ©s:


πŸ› Bug Report: Error 500 when sending an audio file

Description

When trying to send an audio file using the /api/sendVoice endpoint, the server responds with a 500 Internal Server Error. The error seems to be related to puppeteer-core and an evaluate execution in ExecutionContext.js.

πŸ“Œ Steps to reproduce

  1. Make a POST request to /api/sendVoice with the following payload:
    {
      "chatId": "[email protected]",
      "file": {
        "mimetype": "audio/ogg; codecs=opus",
        "url": "https://goline-wabi.s3.us-east-2.amazonaws.com/a8b0f41f-d474-4212-adc9-bb34f478ff26/1743575658068-96dc1453f858eb02.ogg"
      },
      "reply_to": null,
      "session": "a8b0f41f-d474-4212-adc9-bb34f478ff26"
    }
    
  2. The server responds with a 500 error.

🚨 Error log

statusCode: 500
timestamp: 2025-04-02T06:43:02.973Z
exception: 
  stack: 
    at #evaluate (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/ExecutionContext.js:388:56)
    at async ExecutionContext.evaluate (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/ExecutionContext.js:275:16)
    at async IsolatedWorld.evaluate (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/IsolatedWorld.js:100:16)
    at async CdpFrame.evaluate (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/api/Frame.js:341:20)
    at async CdpPage.evaluate (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/api/Page.js:807:20)
    at async WebjsClientPlus.sendMessage (/app/node_modules/whatsapp-web.js/src/Client.js:956:25)
message: "a"
name: "a"

πŸ” Additional information

  • API version: 2025.3.3
  • Engine: WEBJS
  • Browser used: /usr/bin/chromium
  • Platform: Linux (Docker)

🎯 Possible cause

The error occurs when executing evaluate() in puppeteer-core, which suggests that the injected JavaScript code might be failing.

Possible solutions:

  • Ensure that page.evaluate() correctly handles execution in the browser context.
  • Check if the audio file is accessible and properly downloaded before sending.
  • Verify whether a waitForSelector() is needed before executing evaluate().

patron:PLUS

yeiider avatar Apr 02 '25 06:04 yeiider

Hi! Could you try pulling and using devlikeapro/waha-plus:chrome docker image? https://waha.devlike.pro/docs/how-to/engines/#docker-images

patron:PRO

devlikepro avatar Apr 08 '25 06:04 devlikepro

Are you sure that the link is publicly available? Try converting the file to base64 and send it this way

patron:PRO

devlikepro avatar Apr 08 '25 08:04 devlikepro

make sure the url is publicly avaialble (so waha can download it) or try using base64 payload instead

patron:PRO

devlikepro avatar May 04 '25 02:05 devlikepro