pedroslopez / whatsapp-web.js

A WhatsApp client library for NodeJS that connects through the WhatsApp Web browser app
https://wwebjs.dev
Apache License 2.0
15.53k stars 3.7k forks source link

Error when sending a message #1449

Closed wacns closed 11 months ago

wacns commented 2 years ago

Is there an existing issue for this?

Describe the bug

C:...........\My-Bots\node_modules\puppeteer\lib\cjs\puppeteer\common\ExecutionContext.js:221 throw new Error('Evaluation failed: ' + helper_js_1.helper.getExceptionMessage(exceptionDetails)); ^

Error: Evaluation failed: g at ExecutionContext._evaluateInternal (C:...........\My-Bots\node_modules\puppeteer\lib\cjs\puppeteer\common\ExecutionContext.js:221:19) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async ExecutionContext.evaluate (C:...........\My-Bots\node_modules\puppeteer\lib\cjs\puppeteer\common\ExecutionContext.js:110:16) at async Client.sendMessage (C:...........\My-Bots\node_modules\whatsapp-web.js\src\Client.js:594:28)

Node.js v18.0.0

Expected behavior

Iam sending media using base64 string since the library supports it. I have used this method a lot but suddenly it's showing me this error

Steps to Reproduce the Bug or Issue

  1. setting up new MessageMedia('video/mp4', Base64, 'video.mp4')
  2. sending the message
  3. error occures

Relevant Code

const send = new MessageMedia("video/mp4", base, ${number}.mp4); client_whatsapp.sendMessage(message.from, send, { sendMediaAsDocument: true });

Browser Type

Google Chrome

WhatsApp Account Type

WhatsApp Business

Does your WhatsApp account have multidevice enabled?

Yes, I am using Multi Device

Environment

OS: Windows Phone OS: IOS whatsapp-web.js: v1.16.6 Whatsapp Web Version: 2.2216.6 Node.js Version: v18.0.0

Additional context

No response

jonylim commented 2 years ago

Hi, we got the same error. From my team's investigation, we found out that this issue occur when you send media files with file size exceeding limit determined by WhatsApp (16 MB for media, 100 MB for document). Additionally, if the media is a video, the error will also happen regardless of the file size. For video, we temporarily solve this issue by sending video as document using { sendMediaAsDocument: true }

wacns commented 2 years ago

Hi, we got the same error. From my team's investigation, we found out that this issue occur when you send media files with file size exceeding limit determined by WhatsApp (16 MB for media, 100 MB for document).

Additionally, if the media is a video, the error will also happen regardless of the file size. For video, we temporarily solve this issue by sending video as document using { sendMediaAsDocument: true }

Well, I've found another issue related to this bug, it seems that the library is failing to decode the first message. I'm not sure how to solve this but just turned off my bot for a while and ran it again and this error was solved.

L337C0D3R commented 2 years ago

same here, getting this while sending wav audio file (117KB)

aKamrani commented 2 years ago
C:\..\..\node_modules\whatsapp-web.js\node_modules\puppeteer\lib\cjs\puppeteer\common\ExecutionContext.js:221
            throw new Error('Evaluation failed: ' + helper_js_1.helper.getExceptionMessage(exceptionDetails));
                  ^

Error: Evaluation failed: a
    at ExecutionContext._evaluateInternal (C:\..\..\node_modules\whatsapp-web.js\node_modules\puppeteer\lib\cjs\puppeteer\common\ExecutionContext.js:221:19)
    at async ExecutionContext.evaluate (C:\..\..\node_modules\whatsapp-web.js\node_modules\puppeteer\lib\cjs\puppeteer\common\ExecutionContext.js:110:16)
    at async Client.sendMessage (C:\..\..\node_modules\whatsapp-web.js\src\Client.js:594:28)
    at async Timeout._onTimeout (C:\..\..\app.js:64:41)
C:\..\..\app.js:81
                if (err) throw err;
                         ^

Error: exit code 1
    at ChildProcess.<anonymous> (C:\..\..\app.js:111:39)
    at ChildProcess.emit (node:events:527:28)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)

I had this error and as @jonylim said it's related to the size limitation of whatsapp platform. try to set sendMediaAsDocument: true if your media is more than 16MB, and if you got this error yet let's check if base64 conversion and mime type is correct.

islamelgaidi commented 2 years ago

same with me @PurpShell

Lucas-Angelo commented 2 years ago

Hi, we got the same error. From my team's investigation, we found out that this issue occur when you send media files with file size exceeding limit determined by WhatsApp (16 MB for media, 100 MB for document). Additionally, if the media is a video, the error will also happen regardless of the file size. For video, we temporarily solve this issue by sending video as document using { sendMediaAsDocument: true }

not work for me

yusufhdishub commented 1 year ago

the actually problem of all of this error is in puppeteer librarry @pedroslopez how to solve this?

Ashish-bmn commented 1 year ago

Hi, we got the same error. From my team's investigation, we found out that this issue occur when you send media files with file size exceeding limit determined by WhatsApp (16 MB for media, 100 MB for document). Additionally, if the media is a video, the error will also happen regardless of the file size. For video, we temporarily solve this issue by sending video as document using { sendMediaAsDocument: true }

getting error Error: Evaluation failed: N at ExecutionContext._evaluateInternal (C:\sample\waba_whatsapp_chat\node_modules\puppeteer\src\common\ExecutionContext.ts:273:13) at processTicksAndRejections (node:internal/process/task_queues:95:5) at ExecutionContext.evaluate (C:\sample\waba_whatsapp_chat\node_modules\puppeteer\src\common\ExecutionContext.ts:140:12) at Client.sendMessage (C:\sample\waba_whatsapp_chat\node_modules\whatsapp-web.js\src\Client.js:795:28) at EventEmitter. (C:\sample\waba_whatsapp_chat\src\main.ts:271:31)

totallynotdavid commented 1 year ago

Did anyone manage to solve this issue?

Ashish-bmn commented 1 year ago

Did anyone manage to solve this issue?

Use this , if you are working with chrome

const client = new Client( { puppeteer: { executablePath:"C:\Program Files\Google\Chrome\Application\chrome.exe" } }

aidar87 commented 9 months ago

I got error Error: Evaluation failed: B at ExecutionContext._evaluateInternal (/node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:221:19 but noticed tha memory usage was 100 %. Increased memory and seems it works