whatsapp-web.js icon indicating copy to clipboard operation
whatsapp-web.js copied to clipboard

Error when sending a message

Open wacns opened this issue 2 years ago • 4 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

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

wacns avatar May 09 '22 21:05 wacns

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 }

jonylim avatar May 12 '22 12:05 jonylim

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.

wacns avatar May 12 '22 16:05 wacns

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

L337C0D3R avatar May 21 '22 08:05 L337C0D3R

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.

aKamrani avatar May 25 '22 19:05 aKamrani

same with me @PurpShell

islamelgaidi avatar Oct 04 '22 17:10 islamelgaidi

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

Lucas-Angelo avatar Oct 30 '22 18:10 Lucas-Angelo

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

yusufhdishub avatar Jun 20 '23 08:06 yusufhdishub

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)

Ashish-bmn avatar Jul 06 '23 06:07 Ashish-bmn

Did anyone manage to solve this issue?

totallynotdavid avatar Jul 18 '23 21:07 totallynotdavid

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" } }

Ashish-bmn avatar Jul 19 '23 03:07 Ashish-bmn

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

aidar87 avatar Feb 06 '24 12:02 aidar87