whatsapp-web.js: WhatsApp does not work on v2.3XXX
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
Three days ago I started to receive the following error on account start:
Evaluation failed: TypeError: Cannot read properties of undefined (reading 'push')\n at fillModuleArray (eval at <anonymous> (:2:5), <anonymous>:6:74)\n at moduleRaid (eval at <anonymous> (:2:5), <anonymous>:15:3)\n at puppeteer_evaluation_script:4:17
Expected behavior
As a user, I expect to be logged in and able to send messages. But I am seeing desribed error.
Steps to Reproduce the Bug or Issue
- Run basic example
- On some accounts it is not logged in
Relevant Code
No response
Browser Type
Chromium
WhatsApp Account Type
Standard
Does your WhatsApp account have multidevice enabled?
Yes, I am using Multi Device
Environment
OS: Linux and Windows whatsapp-web.js version: latest, installed directly from GitHub (https://github.com/pedroslopez/whatsapp-web.js/commit/ef2f725bce1bd1afd8491f9de0cd2ed06a6febc3) WhatsApp Web version: 2.3000.1011643235 Node.js version: v18.19.0
Additional context
- It is possible that the problem is related to new version (https://github.com/pedroslopez/whatsapp-web.js/commit/17c75ccf5f5a5103e80f8eaa08e641f065de4fea new 2.2408.1 wweb version)
- I found where error is thrown, it is inside
moduleraidlibrary (Related issue - https://github.com/pedroslopez/moduleRaid/issues/5) - Other related issues - https://github.com/pedroslopez/whatsapp-web.js/issues/2785
About this issue
- Original URL
- State: open
- Created 4 months ago
- Reactions: 8
- Comments: 155
Relevant WWeb versions can be found here
SOLVED Use :
webVersionCache: { type: ‘remote’, remotePath: ‘https://raw.githubusercontent.com/wppconnect-team/wa-version/main/html/2.2410.1.html’, }
Please don’t close this issue because I took the time to find the specific place where this error occurs. I’ve searched through existing issues and not a single potential duplicate mentions a solution. My previous issue was closed without any clarifications about reasons for that.
Apparently they are moving from Webpack to some other framework called Comet. In order to reproduce the problem and get the 2.3000 version that is based on Comet you need to add a cookie: wa_build=c You can add it manually in DevTools and refresh the page. Hopefully this will help someone to figure out how to find the modules under Comet. As a temporary workaround for users that are already getting the Comet version, remove this cookie or change it to wa_build=w and refresh the page.
Is there any update or solution related to this issue?
Solved by putting the line below in Client.js:
Funcionou pra mim fazendo: Alterando em: webCache/LocalWebCache.js a linha 34; De: const version = indexHtml.match(/manifest-([\d\.]+).json/)[1]; Para: const version = indexHtml.match(/manifest.json/)[1]; Depois fui em moduleRaid na lib node_modules/@pedroslopez/moduleraid e fiz a modificação do Devaec
apparently WhatsApp has finally switched to Comet. Deleting cookies doesn’t help, all accounts have this error
Can you explain in a little more detail?
@pedroslopez We need your help, the problem persists
Hey everyone! I haven’t noticed that the update already started rolling out. I’ll be updating moduleRaid to support the new version, it is very simple!
Any updates? Still receiving this error. After clearing session, reconnection of account passes couple of hours and error showing.
this worked for me
Código completo aqui nesta PR abaixo, mas precisa de compilar o moduleRaid e instalar pelo .tgz dele. PR 2882
for me this worked
If anyone encounter error while trying to send media using new release
Just change this line
const mediaObject = window.Store.MediaObject.getOrCreateMediaObject(mediaData.filehash);Into this
const mediaObject = window.Store.MediaObject(mediaData.filehash);In src/util/Utils.js on line 323, and give a try
Another approach and to keep legacy compatibility, is to change the line which export mediaobject in
src/util/Injected/store.jsfrom
window.Store.MediaObject = require('WAWebMediaStorage').getOrCreateMediaObject;To
window.Store.MediaObject = require('WAWebMediaStorage');In this way we do not need to change the Utils.js file because is common between legacy and version, and we just change store exposing for new one where the real issue occurs
Lo mismo,a mi también me funcionó esto,solo borre las sesiones
A mi me funciono las soluciones de
Lo unico es que tuve que borrar las sessiones ya existentes y hacer login con QR desde el principio
the solution is here , it works for me
same here
After this Whatsapp sent a message saying that I was using an unofficial application and closed my WhatsApp, it did not block the line but it did close the account.
Hello,
const SESSION_FILE_PATH = ‘./session.json’;
let sessionData;
if (fs.existsSync(SESSION_FILE_PATH)) { sessionData = require(SESSION_FILE_PATH); }
const client = new Client({ puppeteer: { executablePath: ‘C:\Program Files\Google\Chrome\Application\chrome.exe’, args: [‘–no-sandbox’] }, authStrategy: new LocalAuth({ clientId: “Client-one” }), webVersionCache: { type: ‘remote’, remotePath: ‘https://raw.githubusercontent.com/wppconnect-team/wa-version/main/html/2.2407.1.html’ } });
client.on(‘qr’, (qr) => { qrcode.generate(qr, { small: true }); });
client.on(‘authenticated’, (session) => { console.log(‘Conexión exitosa’); sessionData = session; if (sessionData) { fs.writeFile(SESSION_FILE_PATH, JSON.stringify(session), (err) => { if (err) { console.error(err); } }); } });
use it like this it works perfect, send messages, receive, send files, and save the session
It didn’t work here, I still get the error
usr/src/app/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’) at LocalWebCache.persist (/usr/src/app/node_modules/whatsapp-web.js/src/webCache/LocalWebCache.js:34:69) at /usr/src/app/node_modules/whatsapp-web.js/src/Client.js:744:36 at processTicksAndRejections (node:internal/process/task_queues:96:5)
any updates on this?
Its correct. For that I said is a temporary solution while we work on supporting 2.3xx completely.
i went line by line… its not on the latest version yet
What worked for me:
Get the moduleraid.js file from this link https://github.com/wwebjs/moduleRaid
And apply the changes from https://github.com/pedroslopez/whatsapp-web.js/issues/2789#issuecomment-2034553600 and https://github.com/pedroslopez/whatsapp-web.js/issues/2789#issuecomment-2034333596 comments.
It’s working perfectly.
Testei a sua solução e a conexão é feita, mas outros erros começaram a aparecer.
Quando envio a mensagem para o Whatsapp: ERROR: Error handling whatsapp message: Err: [object Object] Ou quando tento enviar uma mensagem: Err: Error: Protocol error (Runtime.callFunctionOn): Session closed.
webpack-exodus branch Just release a fix
Can you explain a little more? Using this file version we can use on 2.3x?
I see, but in our case, we are using
RemoteAuth, and this would hardcode the same version (2.2407.3) for every client that creates a whatsapp session, am I correct? EDIT: fix typoHey folks, we are using RemoteAuth given that we have several sessions being managed by the same app. has anybody been able to find a workaround for this problem? I has started happening today and it cannot start a sesion:
Read the closed issue mentioned in my comment it contains the explanation of the issue and the title of some solutions and workarounds, but you can find the details about these solutions and workaround within pull requests and issues comments
Read every pull request and every issue , because the solution in current time is not included in one place as it is not based on one reason
If you want, you can join discord server, it has too many conversation about all new issues and about current status of the service
https://discord.gg/H7DqQs4
Hello after use this code with const client = new Client({ puppeteer: { headless: false }, authStrategy: new LocalAuth({ clientId: “Client-one” }), webVersionCache: { type: ‘remote’, remotePath: ‘https://raw.githubusercontent.com/wppconnect-team/wa-version/main/html/2.2407.1.html’ } }); this app, work for me.
This worked for me by modifying the Client.js file
Thank you very much! It took a while, but it worked without having to scan the QRcode again. In my case I am using PM2 to restart the application.
Funcionou para mim.
I use LocalAuth every time I want to reload the cache, the error message always appears, please help me
How do you get wweb version 2.3000? Last version seems to be 2.2408
This is the line which cause the problem (https://github.com/pedroslopez/moduleRaid/blob/1867c12241b0d6200bd0d8dc852e875d95278ea3/moduleraid.js#L14):