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
14.41k stars 3.44k forks source link

After scanning the QRCODE and starting whatsapp, loading completely, it returns the following error. #2094

Open DevShop1251 opened 1 year ago

DevShop1251 commented 1 year ago

Describe the bug

C:\Users\55419\Downloads\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: TypeError: Cannot read properties of undefined (reading 'isNewsletter') at Object.t.canReplyMsg (https://web.whatsapp.com/app.39064ec0dec361638b30.js:72:689860) at Object.window.WWebJS.sendMessage (puppeteer_evaluation_script:36:41) at puppeteer_evaluation_script:10:45 at ExecutionContext._evaluateInternal (C:\Users\55419\Downloads\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:\Users\55419\Downloads\bots\node_modules\puppeteer\lib\cjs\puppeteer\common\ExecutionContext.js:110:16) at async Client.sendMessage (C:\Users\55419\Downloads\bots\src\Client.js:686:28) at async Client. (C:\Users\55419\Downloads\bots\example.js:55:9)

Node.js v18.14.0

Ayperoz commented 1 year ago

I solve this error in the console by updating whatsapp-web.js, I recommend you try both options 1 - run npm update whatsapp-web.js 2 - Delete the folder node_modules and reinstall.

DevShop1251 commented 1 year ago

I solve this error in the console by updating whatsapp-web.js, I recommend you try both options 1 - run npm update whatsapp-web.js 2 - Delete the folder node_modules and reinstall.

It didn't work either way...

erlete commented 1 year ago

I solve this error in the console by updating whatsapp-web.js, I recommend you try both options 1 - run npm update whatsapp-web.js 2 - Delete the folder node_modules and reinstall.

It didn't work either way...

Try to uninstall and install the package:

npm uninstall whatsapp-web.js
npm install whatsapp-web.js

I believe the issue here is that the install link from the first reference in "whatsapp-web" Google search points to whatsapp-web.js@1.16.4-alpha.0. Make sure to take a look at the latest versions.

marcosdemelo commented 9 months ago

For me, the bug was in calling the processAttachments method. Changed the order of the parameters.

Credits to https://github.com/vilsonei, that fix the bug.

Working here:

  var mc = new Store.MediaCollection(chat);
  mc.processAttachments([{ file: mediaBlob }, 1], 1, chat).then(() => {
    var media = mc._models[0]
    media.sendToChat(chat, { caption: caption });
  });
maelp commented 4 days ago

I have the same issue... on latest 1.24.0

vinibgoulart commented 3 days ago

https://github.com/wppconnect-team/wa-version/commit/7f959f352158729c6e88dd77cf7d38447d7be713