I have been working with whatsapp-wb.js for a while. Recently the package is not working anymore.
Firstly, when I try their latest package i.e. "whatsapp-web.js": "^1.23.0", even before the qr code shows up, it throws:
.../node_modules/whatsapp-web.js/src/webCache/LocalWebCache.js:34
const version = indexHtml.match(/manifest-([d\.]+).json/)[1];
^
TypeError: Cannot read properties of null (reading '1')
On manually adding "?." to fix this, the qrcode shows up. Then after scanning, it throws:
.../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 (.../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 (.../node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:110:16)
at async Client.initialize (.../node_modules/whatsapp-web.js/src/Client.js:323:9)
Tried the following solutions:
- Removed the package and reinstalled it.
- Made a sample fresh node project and still same errors.
- Whatsapp-web js doesn't fire ready event
- https://github.com/pedroslopez/whatsapp-web.js/issues/1786
- On trying some older versions (such as [email protected]) after changing the selector to INTRO_IMG_SELECTOR = ‘[data-icon=’search’], it throws:
.../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 'push')
at fillModuleArray (eval at <anonymous> (:2:5), <anonymous>:6:74)
at moduleRaid (eval at <anonymous> (:2:5), <anonymous>:15:3)
at __puppeteer_evaluation_script__:4:17
at ExecutionContext._evaluateInternal (.../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 (.../node_modules/whatsapp-web.js/node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:110:16)
at async Client.initialize (.../node_modules/whatsapp-web.js/src/Client.js:322:9)
Any ideas how to get it working again?
2
Answers
Add this argument to your Client initialization:
It should end up looking like this:
i am also facing same issue, whats the solution