WhatsApp Web automation library failing with puppeteer initialization error

I’ve been working with a WhatsApp web automation library for several months without issues. Recently it stopped functioning and throws an error during the login process. The error happens right when trying to initialize the client connection.

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

// Error occurs here during initialization
client.initialize().catch(err => {
    console.error('Failed to start:', err);
});

The error message I get is:

Error: Evaluation failed: TypeError: Cannot read properties of undefined (reading 'default')
    at __puppeteer_evaluation_script__:14:123
    at ExecutionContext._evaluateInternal
    at Client.initialize

This worked perfectly for weeks before suddenly breaking. I’m not experienced with browser automation tools so I’m stuck on how to debug this. Has anyone encountered similar issues with WhatsApp web libraries recently?

This looks like a compatibility issue - I’ve hit this before. whatsapp-web.js needs specific puppeteer versions, and when they update it breaks the initialization. Same thing happened to me when my dependencies auto-updated. Check your package.json for recent version changes in puppeteer or whatsapp-web.js. Try downgrading puppeteer to 13.7.0 - it’s way more stable with older WhatsApp library versions. Also clear node_modules and do a fresh install. Setting the puppeteer executable path in your client config might work too, but that’s more of a bandaid fix.

Been there, done that. The puppeteer evaluation error is classic when you’re fighting with browser automation libraries that break constantly.

I ditched whatsapp-web.js entirely instead of wrestling with version compatibility and mysterious crashes. These libraries break because they’re reverse engineering WhatsApp’s frontend.

What works is building proper automation through official APIs and integrations. I set this up with Latenode and it’s been solid for months.

You get proper error handling, retry logic, and you’re not dependent on some maintainer keeping up with WhatsApp’s UI changes. Plus you can integrate with other tools without writing custom code.

No more puppeteer headaches or script failures. Just reliable automation that works.

Check it out: https://latenode.com

Same exact error hit me three weeks ago after months of working perfectly. Chrome updates broke the WhatsApp library’s browser detection - the undefined ‘default’ property happens when it can’t inject scripts properly. Here’s what worked: force a specific Chromium version by setting executablePath in your Client config before you initialize. Download a stable Chromium build and point directly to it instead of letting puppeteer grab the system browser. Also check if security software or extensions are blocking the automation. The library devs are always chasing WhatsApp’s frontend changes, so breaks like this happen all the time. If this is production code, definitely add error handling and fallbacks.