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.39k stars 3.67k forks source link

Evaluation Failed when using LocalAuth #1794

Closed viimajesty closed 11 months ago

viimajesty commented 1 year ago

Is there an existing issue for this?

Describe the bug

LocalAuth does not work for saving sessions, but login works without LocalAuth

/path/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 'default') at puppeteer_evaluation_script:14:123 at ExecutionContext._evaluateInternal (/path/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 (/path/node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:110:16) at async Client.initialize (/path/node_modules/whatsapp-web.js/src/Client.js:267:9)

Node.js v18.11.0

Expected behavior

As a user, I expected client to login and save the session, but it throws error after scanning QR Code.

Steps to Reproduce the Bug or Issue

  1. Use LocalAuth
  2. Scan QR Code

Relevant Code

const qrcode = require('qrcode-terminal');

const { Client, LocalAuth} = require('whatsapp-web.js'); const client = new Client({ authStrategy: new LocalAuth() });

client.on('qr', qr => { qrcode.generate(qr, {small: true}); });

client.on('ready', () => { console.log('Client is ready!'); });

client.initialize();

Browser Type

Chromium

WhatsApp Account Type

WhatsApp Business

Does your WhatsApp account have multidevice enabled?

Yes, I am using Multi Device

Environment

OS: Arch Linux with 6.0.2-arch1-1 Phone OS: Android 10 whatsapp-web.js version: latest installed by npm node.js version 18.11.0

Additional context

LocalAuth worked once then stopped working

pedrosarkis commented 1 year ago

https://github.com/pedroslopez/whatsapp-web.js/issues/1786 There's a hotfix in this issue.