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.
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
Additional context
I try with node version 20 and result is the same.