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:
.../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?
Add this argument to your Client initialization:
webVersionCache: {
type: 'remote',
remotePath: 'https://raw.githubusercontent.com/wppconnect-team/wa-version/main/html/2.2412.54.html',
}
It should end up looking like this:
const client = new Client({
webVersionCache: {
type: "remote",
remotePath:
"https://raw.githubusercontent.com/wppconnect-team/wa-version/main/html/2.2412.54.html",
},
});