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.48k stars 3.69k forks source link

Evaluation failed: TypeError: Cannot read properties of undefined (reading 'default') #3189

Closed Binternet closed 4 months ago

Binternet commented 4 months ago

Is there an existing issue for this?

Describe the bug

An exception is thrown once QR is scanned:

/Users/binternet/www/sandbox/wa-web/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 (/Users/binternet/www/sandbox/wa-web/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 (/Users/binternet/www/sandbox/wa-web/node_modules/whatsapp-web.js/node_modules/puppeteer/lib/js/puppeteer/common/ExecutionContext.js:110:16)
    at async Client.initialize (/Users/binternet/www/sandbox/wa-web/node_modules/whatsapp-web.js/src/Client.js:323:9)

Expected behavior

Client should be initialized

Steps to Reproduce the Bug or Issue

  1. Init the client
  2. Scan the QR

Relevant Code

const client = new Client({
  authStrategy: new LocalAuth({
    dataPath: "./",
  }),
  webVersionCache: { 
    type: 'remote', 
    remotePath: 'https://raw.githubusercontent.com/wppconnect-team/wa-version/main/html/2.3000.1014742999-alpha.htm'
  },
  puppeteer: {
    headless: true,
    args: [
      '--no-sandbox',
      '--disable-setuid-sandbox',
      '--unhandled-rejections=strict',
      '--disable-dev-shm-usage',
      '--disable-accelerated-2d-canvas',
      '--no-first-run',
      '--no-zygote',
      '--single-process',
      '--disable-gpu'
      ],
  }
});

Browser Type

Chromium

WhatsApp Account Type

Standard

Does your WhatsApp account have multidevice enabled?

No, I am not using Multi Device

Environment



### Additional context

_No response_
sachhu commented 4 months ago

I tried this workaround and it is working for me. https://stackoverflow.com/a/78692943