Search code examples
javascriptnode.jspuppeteerwhatsapp

Error after scanning qr code for whatsapp-web.js


My whatsappweb bot started having problems this week.

C:\pinkmeupwabot\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: TypeError: Cannot read properties of undefined (reading 'default')
    at __puppeteer_evaluation_script__:5:95
    at ExecutionContext._evaluateInternal (C:\pinkmeupwabot\node_modules\whatsapp-web.js\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:\pinkmeupwabot\node_modules\whatsapp-web.js\node_modules\puppeteer\lib\cjs\puppeteer\common\ExecutionContext.js:110:16)
    at async Client.initialize (C:\pinkmeupwabot\node_modules\whatsapp-web.js\src\Client.js:323:9)

I tried changing the lib and puppeteer versions but without success, the error remains.

I took a look at the lines that indicate the error but my expertise didn't allow me to get that far. Could anyone help?


Solution

  • What fixed this error for me was changing my webVersionCache inside the client definition:

        client = new Client({
            authStrategy: new LocalAuth(),
            puppeteer: {
                headless: true,
                args: [ '--no-sandbox', '--disable-gpu', ],
            },
            webVersionCache: { type: 'remote', remotePath: 'https://raw.githubusercontent.com/wppconnect-team/wa-version/main/html/2.2412.54.html', }
        });