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.53k stars 3.46k forks source link

Qr Code Scanner - Error #3020

Closed manuonda closed 1 month ago

manuonda commented 1 month ago

Is there an existing issue for this?

Describe the bug

When scanning qr code and waiting for response, error occurs:

whatsapp-web.js/node_modules/puppeteer-core/lib/cjs/puppeteer/common/ExecutionContext.js:229 throw new Error('Evaluation failed: ' + (0, util_js_1.getExceptionMessage)(exceptionDetails)); ^

Error: Evaluation failed: TypeError: Cannot read properties of undefined (reading 'default') at pptr://puppeteer_evaluation_script:5:95 at ExecutionContext._ExecutionContext_evaluate (/home/manuonda/projects/javascript-ts-project/ia/asistente/node_modules/whatsapp-web.js/node_modules/puppeteer-core/lib/cjs/puppeteer/common/ExecutionContext.js:229:15) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async ExecutionContext.evaluate (/home/manuonda/projects/javascript-ts-project/ia/asistente/node_modules/whatsapp-web.js/node_modules/puppeteer-core/lib/cjs/puppeteer/common/ExecutionContext.js:107:16) at async Client.initialize (/home/manuonda/projects/javascript-ts-project/ia/asistente/node_modules/whatsapp-web.js/src/Client.js:340:9)

Expected behavior

As a user I was expecting to show in the console that the client connected but it was showing an error in the output.

Steps to Reproduce the Bug or Issue

1 - Install dependencys my file package.json is : { "dependencies": { "@whiskeysockets/baileys": "^6.7.2", "puppeteer": "^22.8.0", "qrcode-terminal": "^0.12.0", "whatsapp-web.js": "^1.23.1-alpha.6" }, "name": "asistente", "version": "1.0.0", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", "start": "node index" }, "keywords": [], "author": "", "license": "ISC", "description": "" }

2 - Create file main.js with the next code : `

const { Client } = require('whatsapp-web.js'); const qrcode = require('qrcode-terminal');

const client = new Client();

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

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

client.initialize(); `

Relevant Code

This code is simple in the file main.js :

const { Client } = require('whatsapp-web.js'); const qrcode = require('qrcode-terminal');

const client = new Client();

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

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

client.initialize();

Browser Type

Google Chrome

WhatsApp Account Type

Standard

Does your WhatsApp account have multidevice enabled?

No, I am not using Multi Device

Environment

OS:  Ubuntu 22
Phone OS: Android 
whatsapp-web.js : ^1.23.1-alpha.6
WhatsApp Web version: Whastapp Messenger 2.24.9.78
Node.js Version : v18.19.0

Additional context

I try with node version 20 and result is the same.

alechkos commented 1 month ago

2789

2816