Comments (155)
const wwebVersion = '2.2412.54';
const client = new Client({
authStrategy: new LocalAuth(), // your authstrategy here
puppeteer: {
// puppeteer args here
},
// locking the wweb version
webVersionCache: {
type: 'remote',
remotePath: `https://raw.githubusercontent.com/wppconnect-team/wa-version/main/html/${wwebVersion}.html`,
},
});
Relevant WWeb versions can be found here
from whatsapp-web.js.
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.
from whatsapp-web.js.
I use LocalAuth every time I want to reload the cache, the error message always appears, please help me
SOLVED Use :
webVersionCache: {
type: 'remote',
remotePath: 'https://raw.githubusercontent.com/wppconnect-team/wa-version/main/html/2.2410.1.html',
}
from whatsapp-web.js.
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.
from whatsapp-web.js.
Is there any update or solution related to this issue?
from whatsapp-web.js.
Solved by putting the line below in Client.js:
from whatsapp-web.js.
Any updates?
Still receiving this error.
After clearing session, reconnection of account passes couple of hours and error showing.
from whatsapp-web.js.
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!
from whatsapp-web.js.
Hi, I found a temporary solution .
The error
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/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:340:3)at
src/Client.js #339
await page.evaluate(ExposeStore, moduleRaid.toString());.
The source code of WA is different when the browser is reloaded an there is a session. The new version 2.3.x.x set a cookie
wa_build
and these make the source code changes. ( @micmil1977 said it )The solution is remove the cookie always. If the cookie was present when the puppeteer was loaded the page, delete cookie and reload it
The code:
await page.deleteCookie({name:'wa_build', domain:'.web.whatsapp.com', path:'/'});I put it in all places i can because i don't know when the cookie is established.
Can you explain in a little more detail?
@pedroslopez We need your help, the problem persists
from whatsapp-web.js.
apparently WhatsApp has finally switched to Comet. Deleting cookies doesn't help, all accounts have this error
from whatsapp-web.js.
Hi, I found a temporary solution .
The errorError: 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/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:340:3)at
src/Client.js #339
await page.evaluate(ExposeStore, moduleRaid.toString());.
The source code of WA is different when the browser is reloaded an there is a session. The new version 2.3.x.x set a cookiewa_build
and these make the source code changes. ( @micmil1977 said it )
The solution is remove the cookie always. If the cookie was present when the puppeteer was loaded the page, delete cookie and reload it
The code:await page.deleteCookie({name:'wa_build', domain:'.web.whatsapp.com', path:'/'});I put it in all places i can because i don't know when the cookie is established.
Can you explain in a little more detail?
@pedroslopez We need your help, the problem persistsThe cookie make the source of the web changes:
The new source code with cookie
The old source code was loaded if the cookie is not present
I notice the cookie was setted after the auth is ready so i put the code:class LocalAuth extends BaseAuthStrategy { ... async afterAuthReady() { const page = this.client.pupPage; await page.deleteCookie({name:'wa_build', domain:'.web.whatsapp.com', path:'/'}); } ... }If the cookie is present in the line 339 on
src/Client.js
I suggest execute the code and reload the Client.await page.deleteCookie({name:'wa_build', domain:'.web.whatsapp.com', path:'/'});Psdt: I used the commit 1.23.1-alpha.5
I do not suggest this method, as maybe whatsapp can detect that same client is going in a short way from old to new version and vice versa and this may lead to some bad classifications,
I prefer to work on supporting new version instead of keep running away from it
Its correct. For that I said is a temporary solution while we work on supporting 2.3xx completely.
from whatsapp-web.js.
in V2.3, when trying to send a message with error 'window.Store.MsgKey is not a constructor' any idea how to solve it? have you succeeded sending text message in V2.3?
any updates on this?
from whatsapp-web.js.
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)
from whatsapp-web.js.
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
from whatsapp-web.js.
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.
from whatsapp-web.js.
This is the line which cause the problem (https://github.com/pedroslopez/moduleRaid/blob/1867c12241b0d6200bd0d8dc852e875d95278ea3/moduleraid.js#L14):
from whatsapp-web.js.
How do you get wweb version 2.3000? Last version seems to be 2.2408
from whatsapp-web.js.
I use LocalAuth every time I want to reload the cache, the error message always appears, please help me
from whatsapp-web.js.
await page.deleteCookie({name:'wa_build',domain:'.web.whatsapp.com',path:'/'});
Funcionou para mim.
from whatsapp-web.js.
Olá,
const SESSION_FILE_PATH = './session.json';
deixe sessionData;
if (fs.existsSync(SESSION_FILE_PATH)) { sessionData = require(SESSION_FILE_PATH); }
cliente const = novo cliente ({ 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 (erro) { console.error(erro); } }); } });
use assim funciona perfeitamente, envie mensagens, receba, envie arquivos e salve a sessão
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.
from whatsapp-web.js.
This worked for me by modifying the Client.js file
from whatsapp-web.js.
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
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.
from whatsapp-web.js.
@denikaryadi what file is this? @noobsmatr619 what folder? @MoudiZd I didn't understand your solution or workaround, I'm just trying to start whatsapp without issues.
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
from whatsapp-web.js.
Hey 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:
Session does not exist. Creating userDataDir...
extractRemoteSession completed.
beforeBrowserInitialized completed.
/home/ec2-user/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 (/home/ec2-user/whatsapp-web.js/src/webCache/LocalWebCache.js:34:69)
at /home/ec2-user/whatsapp-web.js/src/Client.js:775:36
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Node.js v18.18.2
from whatsapp-web.js.
Same problem last 3 days
from whatsapp-web.js.
Please help
from whatsapp-web.js.
As I see they are rolling out WhatsApp web v 2.3000 little by little, so bug need to be fixed.
from whatsapp-web.js.
I get this version from Client.getWWebVersion https://docs.wwebjs.dev/Client.html#getWWebVersion
from whatsapp-web.js.
Until the patch for wweb v2.3xxx is out use the webcache with wweb v2.2xxx
#1847
#2293 (comment)
Relevant wweb versions can be found here
from whatsapp-web.js.
I use LocalAuth every time I want to reload the cache, the error message always appears, please help meSOLVED Use :
webVersionCache: { type: 'remote', remotePath: 'https://raw.githubusercontent.com/wppconnect-team/wa-version/main/html/2.2410.1.html', }
please share WAPI js file
from whatsapp-web.js.
The proposed workaround is not working for me but thanks for the push in the right direction. I changed it to a slightly older version:
webVersionCache: {
type: 'remote',
remotePath: 'https://raw.githubusercontent.com/wppconnect-team/wa-version/main/html/2.2409.0.html',
}
from whatsapp-web.js.
The proposed workaround is not working for me but thanks for the push in the right direction. I changed it to a slightly older version:
webVersionCache: { type: 'remote', remotePath: 'https://raw.githubusercontent.com/wppconnect-team/wa-version/main/html/2.2409.0.html', }
Sir how to add in WAPI javascript file?
from whatsapp-web.js.
Aparentemente, eles estão mudando do Webpack para algum outro framework chamado Comet. Para reproduzir o problema e obter a versão 2.3000 que é baseada no Comet você precisa adicionar um cookie: wa_build=c Você pode adicioná-lo manualmente no DevTools e atualizar a página. Espero que isso ajude alguém a descobrir como encontrar os módulos sob o Cometa. Como uma solução temporária para usuários que já estão recebendo a versão do Cometa, remova esse cookie ou altere-o para wa_build=w e atualize a página.
What framework is this? link plz
from whatsapp-web.js.
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.
Not anymore, WhatsApp now immediately logs you out when you play with it.
from whatsapp-web.js.
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.
Here have a idea to get modules to new version...
Someone can help to convert moduleraid?
https://d33gom43gwygbg.cloudfront.net/utils/api.js
from whatsapp-web.js.
I've also encountered the same issue.
I found that when I use the WA APP version 2.24.4.78, the cache loads and works normally.
However, when I switch to using WA APP version 2.24.5.75, every time I try to load the cache, it always gives me this same error. My phone is an iPhone.
from whatsapp-web.js.
You can find fix here https://github.com/wppconnect-team/wa-js/pull/1726/files
The main idea to find modules in require('__debug').modulesMap
from whatsapp-web.js.
I created my own moduleRaid for my personal project, it was made to work with webpack and comet:
github.com/jaovitubr/moduleRaid
from whatsapp-web.js.
Still receiving this error
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 (/home/whatsapp/whatsapp/node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:221:19)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async ExecutionContext.evaluate (/home/whatsapp/whatsapp/node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:110:16)
at async Client.initialize (/home/whatsapp/whatsapp/src/Client.js:339:9)
any solutions?
this not working
from whatsapp-web.js.
ModuleError: Requiring module "%s" with unresolved dependencies: %s
Getting this error
from whatsapp-web.js.
I've also encountered the same issue. I found that when I use the WA APP version 2.24.4.78, the cache loads and works normally. However, when I switch to using WA APP version 2.24.5.75, every time I try to load the cache, it always gives me this same error. My phone is an iPhone.
===================
After completing the following two steps, I resolved the issue
- alter src/util/Constants.js webVersion: '2.2410.1'
- alter const client = new Client({
authStrategy: new LocalAuth(), // your authstrategy here
puppeteer: {
// puppeteer args here
},
webVersionCache: {
type: 'remote',
remotePath:https://raw.githubusercontent.com/wppconnect-team/wa-version/main/html/2.2410.1.html
,
},
});
from whatsapp-web.js.
Any update on this? how to work around webpackChunkwhatsapp_web_client not being available on v2.3000?
A new pull request to the moduleRaid has been submitted and it must solve the issue with new version, take a look
from whatsapp-web.js.
ModuleError: Requiring module "%s" with unresolved dependencies: %s
Getting this error
The reason of this error is that requiring modules is not wrapped within a try catch block, which generate a lot of errors
Also the error guard must be skipped temporarily while requiring modules as modules map contains a lot of modules that cannot and might not be required.
Anyway a new pull request to the moduleRaid has been submitted, you can check it here
from whatsapp-web.js.
Still receiving this error
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 (/home/whatsapp/whatsapp/node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:221:19) at processTicksAndRejections (node:internal/process/task_queues:96:5) at async ExecutionContext.evaluate (/home/whatsapp/whatsapp/node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:110:16) at async Client.initialize (/home/whatsapp/whatsapp/src/Client.js:339:9)
any solutions?
this not working
The default property is no longer existing in modules, so a workaround has been suggested in following pull request
from whatsapp-web.js.
Thanks for the module Raid update. It worked for me.
Now it seems that we cannot send attachment because the createFromData function is not available in v2.3000. Can you confirm this?
whatsapp-web.js/src/util/Injected.js
Line 26 in 72a1881
whatsapp-web.js/src/util/Injected.js
Line 469 in 72a1881
from whatsapp-web.js.
I can't get the module (with .default) at all. Use "new moduleRaid"
from whatsapp-web.js.
Check this PR 2825
Thanks for the module Raid update. It worked for me.
Now it seems that we cannot send attachment because the createFromData function is not available in v2.3000. Can you confirm this?
whatsapp-web.js/src/util/Injected.js
Line 26 in 72a1881
whatsapp-web.js/src/util/Injected.js
Line 469 in 72a1881
from whatsapp-web.js.
is has change on structure, please check this PR 2825
I can't get the module (with .default) at all. Use "new moduleRaid"
from whatsapp-web.js.
Same error here
from whatsapp-web.js.
Thanks
When I updated the moduleRaid, I started getting this error
Error: Evaluation failed: TypeError: Cannot read properties of undefined (reading 'default')
at __puppeteer_evaluation_script__:5:95
at ExecutionContext._evaluateInternal (/home/whatsapp/whatsapp/node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:221:19)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async ExecutionContext.evaluate (/home/whatsapp/whatsapp/node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:110:16)
at async Client.initialize (/home/whatsapp/whatsapp/src/Client.js:339:9)
Then I updated the file Injected.js from the #2825 and everything worked
from whatsapp-web.js.
in V2.3, when trying to send a message with
error 'window.Store.MsgKey is not a constructor' any idea how to solve it?
have you succeeded sending text message in V2.3?
from whatsapp-web.js.
Thanks When I updated the moduleRaid, I started getting this error
Error: Evaluation failed: TypeError: Cannot read properties of undefined (reading 'default') at __puppeteer_evaluation_script__:5:95 at ExecutionContext._evaluateInternal (/home/whatsapp/whatsapp/node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:221:19) at processTicksAndRejections (node:internal/process/task_queues:96:5) at async ExecutionContext.evaluate (/home/whatsapp/whatsapp/node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:110:16) at async Client.initialize (/home/whatsapp/whatsapp/src/Client.js:339:9)
Then I updated the file Injected.js from the #2825 and everything worked
This pr :
wwebjs/moduleRaid#1
has been created in order to not be obligated to change anything in injected.js, but as this pr has been created :
#2825
So the mentioned pr is not necessary anymore and i will close it
from whatsapp-web.js.
in V2.3, when trying to send a message with error 'window.Store.MsgKey is not a constructor' any idea how to solve it? have you succeeded sending text message in V2.3?
Same error here
from whatsapp-web.js.
Hello! i have this problem, anyone have how solve ?
from whatsapp-web.js.
Hello! i have this problem, anyone have how solve ?
It seems that you are trying to send a message to a contact which is not found within your chat list , can you confirm ?
from whatsapp-web.js.
¡Hola! Tengo este problema, ¿alguien tiene cómo solucionarlo?
Parece que está intentando enviar un mensaje a un contacto que no se encuentra dentro de su lista de chat, ¿puede confirmar?
Hello @MoudiZd No, the error appears after I scan the number to authenticate, which does not allow me to use it
from whatsapp-web.js.
Hi, I found a temporary solution .
The error
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/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:340:3)
at src/Client.js #339
await page.evaluate(ExposeStore, moduleRaid.toString());
.
The source code of WA is different when the browser is reloaded an there is a session.
The new version 2.3.x.x set a cookie wa_build
and these make the source code changes.
( @micmil1977 said it )
The solution is remove the cookie always.
If the cookie was present when the puppeteer was loaded the page, delete cookie and reload it
The code:
await page.deleteCookie({name:'wa_build', domain:'.web.whatsapp.com', path:'/'});
I put it in all places i can because i don't know when the cookie is established.
from whatsapp-web.js.
¡Hola! Tengo este problema, ¿alguien tiene cómo solucionarlo?
Parece que está intentando enviar un mensaje a un contacto que no se encuentra dentro de su lista de chat, ¿puede confirmar?
Hello @MoudiZd No, the error appears after I scan the number to authenticate, which does not allow me to use it
Are you listening to any event related to reading messages? If yes, try to stop listening and check if it works
Actually many modules are changed and we need time to test everything to keep everything work on both versions
from whatsapp-web.js.
Hello @MoudiZd Thanks again for your response ❤️
Hello, no I really don't have anything listening or reading the messages, basically I just send messages, but this error occurs under these circumstances.
- Add the number and try to scan the QR
- Sometimes the QR code does not generate the crash, but when you disconnect the number it does.
It is quite strange and I don't know where the problem could come from or what the temporary fix would be.
from whatsapp-web.js.
Hello @MoudiZd Thanks again for your response ❤️
Hello, no I really don't have anything listening or reading the messages, basically I just send messages, but this error occurs under these circumstances.
- Add the number and try to scan the QR
- Sometimes the QR code does not generate the crash, but when you disconnect the number it does.
It is quite strange and I don't know where the problem could come from or what the temporary fix would be.
You are welcome 🤗
As we see in the picture and from the exception, that the error occured from downloadMedia
method that is found within Message.js
under src/structures/Message.js
Actually this method is used to download media from received messages
For that i assume that you are listening to received messages,
so when you scan the qrcode and the number start receiving unread messages, i assume that it encounters some media messages, and for that sometimes the number crashes (when there is some media messages that cannot be downloaded) not all the times
But we need more tests to confirm this.
Actually we are in a weird place now and many things has been changed, it is not about just changing from webpack to comet, but really i think that whatsapp has restructured their modules, i think that things will go clearer in next hours
from whatsapp-web.js.
Hi, I found a temporary solution .
The errorError: 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/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:340:3)at
src/Client.js #339
await page.evaluate(ExposeStore, moduleRaid.toString());.
The source code of WA is different when the browser is reloaded an there is a session. The new version 2.3.x.x set a cookiewa_build
and these make the source code changes. ( @micmil1977 said it )
The solution is remove the cookie always. If the cookie was present when the puppeteer was loaded the page, delete cookie and reload it
The code:await page.deleteCookie({name:'wa_build', domain:'.web.whatsapp.com', path:'/'});I put it in all places i can because i don't know when the cookie is established.
Can you explain in a little more detail?
@pedroslopez We need your help, the problem persists
Before anything,
which wweb repo you are using?
and therefore which moduleRaid version , also which web whatsapp version?
The main branch of this repo, still just supporting web whatsapp version < 2.3 and does not work with new web whatsapp version
For the new web whatsapp version, maybe you can try the webpack-exodus
branch, which has changed the moduleRaid version, that has been used in order to support comet which is used now instead of webpack,
also you may use this pr:
#2825 (comment)
As it is working on changing the way that we search about modules, because as i mentioned in my recent reply, that whatsapp is going to restructuring their modules, and we are not just in front of changing bundler from webpack to comet
Anyway keep your eyes on prs and issues , next hours sure will carry more improvements and more fixes
from whatsapp-web.js.
Hi, I found a temporary solution .
The errorError: 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/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:340:3)at
src/Client.js #339
await page.evaluate(ExposeStore, moduleRaid.toString());.
The source code of WA is different when the browser is reloaded an there is a session. The new version 2.3.x.x set a cookiewa_build
and these make the source code changes. ( @micmil1977 said it )
The solution is remove the cookie always. If the cookie was present when the puppeteer was loaded the page, delete cookie and reload it
The code:await page.deleteCookie({name:'wa_build', domain:'.web.whatsapp.com', path:'/'});I put it in all places i can because i don't know when the cookie is established.
Can you explain in a little more detail?
@pedroslopez We need your help, the problem persists
The cookie make the source of the web changes:
The new source code with cookie
The old source code was loaded if the cookie is not present
I notice the cookie was setted after the auth is ready so i put the code:
class LocalAuth extends BaseAuthStrategy {
...
async afterAuthReady() {
const page = this.client.pupPage;
await page.deleteCookie({name:'wa_build', domain:'.web.whatsapp.com', path:'/'});
}
...
}
If the cookie is present in the line 339 on src/Client.js
I suggest execute the code and reload the Client.
await page.deleteCookie({name:'wa_build', domain:'.web.whatsapp.com', path:'/'});
Psdt: I used the commit 1.23.1-alpha.5
from whatsapp-web.js.
Hi, I found a temporary solution .
The errorError: 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/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:340:3)at
src/Client.js #339
await page.evaluate(ExposeStore, moduleRaid.toString());.
The source code of WA is different when the browser is reloaded an there is a session. The new version 2.3.x.x set a cookiewa_build
and these make the source code changes. ( @micmil1977 said it )
The solution is remove the cookie always. If the cookie was present when the puppeteer was loaded the page, delete cookie and reload it
The code:await page.deleteCookie({name:'wa_build', domain:'.web.whatsapp.com', path:'/'});I put it in all places i can because i don't know when the cookie is established.
Can you explain in a little more detail?
@pedroslopez We need your help, the problem persistsThe cookie make the source of the web changes:
The new source code with cookie
The old source code was loaded if the cookie is not present
I notice the cookie was setted after the auth is ready so i put the code:
class LocalAuth extends BaseAuthStrategy { ... async afterAuthReady() { const page = this.client.pupPage; await page.deleteCookie({name:'wa_build', domain:'.web.whatsapp.com', path:'/'}); } ... }If the cookie is present in the line 339 on
src/Client.js
I suggest execute the code and reload the Client.
await page.deleteCookie({name:'wa_build', domain:'.web.whatsapp.com', path:'/'});Psdt: I used the commit 1.23.1-alpha.5
I do not suggest this method, as maybe whatsapp can detect that same client is going in a short way from old to new version and vice versa and this may lead to some bad classifications,
I prefer to work on supporting new version instead of keep running away from it
from whatsapp-web.js.
@MoudiZd I'm using 2.300 so it's invalid for me when will a solution come for 2.3
from whatsapp-web.js.
in V2.3, when trying to send a message with error 'window.Store.MsgKey is not a constructor' any idea how to solve it? have you succeeded sending text message in V2.3?
Same error here... any workaround pls?
from whatsapp-web.js.
const wwebVersion = '2.2407.3'; const client = new Client({ authStrategy: new LocalAuth(), // your authstrategy here puppeteer: { // puppeteer args here }, webVersionCache: { type: 'remote', remotePath: `https://raw.githubusercontent.com/wppconnect-team/wa-version/main/html/${wwebVersion}.html`, }, });Relevant wweb versions can be found here
Worked for me.
That works, but forces me to recapture the QR, and I can't... any solution without forcing to recapture QR? thanks.
from whatsapp-web.js.
Does this resolve the 2.3X incompatibility definitively?
from whatsapp-web.js.
C:\Users\Administrator\Desktop\V35\node_modules\whatsapp-web.js\src\Client.js:107
await page.deleteCookie({name:'wa_build',domain:'.web.whatsapp.com',path:'/'});
^
TypeError: Cannot read properties of null (reading 'deleteCookie')
at Client.initialize (C:\Users\Administrator\Desktop\V35\node_modules\whatsapp-web.js\src\Client.js:107:24)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Node.js v21.7.1
from whatsapp-web.js.
Isso resolve a incompatibilidade 2.3X definitivamente?
It works for me
from whatsapp-web.js.
C:\Usuários\Administrador\Desktop\V35\node_modules\whatsapp-web.js\src\Client.js:107 await page.deleteCookie({nome:'wa_build',domínio:'.web.whatsapp.com',caminho :'/'}); ^
TypeError: Não é possível ler propriedades de null (lendo 'deleteCookie') em Client.initialize (C:\Users\Administrator\Desktop\V35\node_modules\whatsapp-web.js\src\Client.js:107:24) no processo. processTicksAndRejections (nó: interno/processo/task_queues:95:5)
Node.js v21.7.1
It looks to me like your page object is null, check if your puppeteer browser is opening the page.
from whatsapp-web.js.
C:\Usuários\Administrador\Desktop\V35\node_modules\whatsapp-web.js\src\Client.js:107 await page.deleteCookie({nome:'wa_build',domínio:'.web.whatsapp.com',caminho :'/'}); ^
TypeError: Não é possível ler propriedades de null (lendo 'deleteCookie') em Client.initialize (C:\Users\Administrator\Desktop\V35\node_modules\whatsapp-web.js\src\Client.js:107:24) no processo. processTicksAndRejections (nó: interno/processo/task_queues:95:5)
Node.js v21.7.1It looks to me like your page object is null, check if your puppeteer browser is opening the page.
its not opening because of that error
from whatsapp-web.js.
thanks, this one works perfectly on my side
from whatsapp-web.js.
I use LocalAuth every time I want to reload the cache, the error message always appears, please help meSOLVED Use :
webVersionCache: { type: 'remote', remotePath: 'https://raw.githubusercontent.com/wppconnect-team/wa-version/main/html/2.2410.1.html', }
I used this solution. It worked fine for some time, then it blocked my number stating that the number violated the commerce policy of WhatsApp
from whatsapp-web.js.
It's working so far
from whatsapp-web.js.
It works well for me, it doesn't give me an error, but it doesn't save the session, it always generates the QR
from whatsapp-web.js.
thanks, this one works perfectly on my side
although it works for me, but keep in mind, I got warning message from whatsapp that my account is suspicious and will be inactive soon
from whatsapp-web.js.
Same problem, any solution please?
/home/deploy/api-whatsapp/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')
from whatsapp-web.js.
Hello, someone was able to find a solution to the problem, I tried with the answer of the partner, although the error no longer jumps, but I ask me to rescan the qr code.
from whatsapp-web.js.
Same problem, any solution please?
/home/deploy/api-whatsapp/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')
try this:
async persist(indexHtml) {
// extract version from index (e.g. manifest-2.2206.9.json -> 2.2206.9)
let version;
if (indexHtml.match(/manifest-([\d\\.]+)\.json/) === null) {
return null;
} else {
version = indexHtml.match(/manifest-([\d\\.]+)\.json/)[1];
}
if (!version) return;
const filePath = path.join(this.path, `${version}.html`);
fs.mkdirSync(this.path, { recursive: true });
fs.writeFileSync(filePath, indexHtml);
}
from whatsapp-web.js.
from whatsapp-web.js.
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
sure, but I already scanned the qr before, I don't want to rescan it every time I have to send messages, before this error, the session was saved and worked every time I ran the method.
from whatsapp-web.js.
The session is saved, you do not have to scan it just 1 time.
The code goes in the app.js is how it is. saves and reads the saved session.
from whatsapp-web.js.
The session is saved, you do not have to scan it just 1 time.
The code goes in the app.js is how it is. saves and reads the saved session.
the session is saved at the first scan, but if I stop the application, it asks to scan the qr again.
from whatsapp-web.js.
I solved it with the code I provided, I saw that the problem was in how I called the saved session.
from whatsapp-web.js.
A sessão é salva, você não precisa digitalizá-la apenas uma vez.
O código vai no app.js é assim. salva e lê a sessão salva.a sessão é salva na primeira varredura, mas se eu parar o aplicativo, ele pede para escanear o qr novamente.
Check if you are using LocalAuth like below:
const client = new Client({
authStrategy: new LocalAuth(),
puppeteer: {
// executablePath: "C:Program FilesGoogleChromeApplicationchrome.exe",
// headless: true,
args: ["--no-sandbox"],
},
webVersionCache: {
type: "remote",
remotePath:
"https://raw.githubusercontent.com/wppconnect-team/wa-version/main/html/2.2407.1.html",
},
});
from whatsapp-web.js.
it still does not work, I have multiple sessions saved, from several phones, in only some I have the problem that the index error pops up.
I tried your own solutions and it doesn't work, it keeps asking me to scan the qr when I already scanned it the previous time.
this is how I use it, every time I want to send messages, I send messages according to the phone id and based on that I look for the saved session in the root of the project.
const dataPath = path.resolve(__dirname, '../Sesiones');
const sessionState = ObtenerSesionWhatsapp(idTelefono);
if (!sessionState) {
return res.status(400)
.send('Disconect');
}
const whatsappClient = new Client({
authStrategy: new LocalAuth({
clientId: `cliente-${idTelefono}`,
dataPath: dataPath,
}),
puppeteer: { headless: true },
webVersionCache: {
type: 'remote',
remotePath: 'https://raw.githubusercontent.com/wppconnect-team/wa-version/main/html/2.2407.1.html'
}
});
from whatsapp-web.js.
I solve the problem "Cannot read properties of null (reading '1')" by manually adding webVersion value match the .wwebjs_cache html version to the client
from whatsapp-web.js.
I solve the problem "Cannot read properties of null (reading '1')" by manually adding webVersion value match the .wwebjs_cache html version to the client
if you have more than one active session, more than one html is created in the wwebjs_cache, how do you know which one corresponds to each one, or if you have more than one synchronized phone?
from whatsapp-web.js.
I solve the problem "Cannot read properties of null (reading '1')" by manually adding webVersion value match the .wwebjs_cache html version to the client
if you have more than one active session, more than one html is created in the wwebjs_cache, how do you know which one corresponds to each one, or if you have more than one synchronized phone?
I am sorry, in my case just have one session active for now. I tried to place two version of html 2.2411.2 and latest 2.2412.50 and both can be used.
from whatsapp-web.js.
it still does not work, I have multiple sessions saved, from several phones, in only some I have the problem that the index error pops up. I tried your own solutions and it doesn't work, it keeps asking me to scan the qr when I already scanned it the previous time.
this is how I use it, every time I want to send messages, I send messages according to the phone id and based on that I look for the saved session in the root of the project.
const dataPath = path.resolve(__dirname, '../Sesiones');
const sessionState = ObtenerSesionWhatsapp(idTelefono); if (!sessionState) { return res.status(400) .send('Disconect'); } const whatsappClient = new Client({ authStrategy: new LocalAuth({ clientId: `cliente-${idTelefono}`, dataPath: dataPath, }), puppeteer: { headless: true }, webVersionCache: { type: 'remote', remotePath: 'https://raw.githubusercontent.com/wppconnect-team/wa-version/main/html/2.2407.1.html' } });
I had tried to use webVersionCache with external link like you with partial success. Removing it (webVersionCache) and editing Client.js to remove the cookie wa_build has being more effective
from whatsapp-web.js.
thanks,, work for me.
from whatsapp-web.js.
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
where d i paste this code ??
from whatsapp-web.js.
some definitive solution?
from whatsapp-web.js.
I have two servers, one running Windows and the other running Ubuntu Server. I'm experiencing issues on Ubuntu, but not on Windows. I think that might be where the problem lies.
from whatsapp-web.js.
can someone connect via team viewer and help me solve the issue of session not being able to be picked when i rerun the code... im prepared to pay you if u solve my whatsapp +263785866344
from whatsapp-web.js.
can someone connect via team viewer and help me solve the issue of session not being able to be picked when i rerun the code... im prepared to pay you if u solve my whatsapp +263785866344
Read more here :
from whatsapp-web.js.
hello i opened this :
#2856
and wrapped up everything related to the current discussed issue, from causes to technical details to workarounds in one place, please keep it open
from whatsapp-web.js.
#1795 (comment)
removing the session worked for me, according to the comment above
from whatsapp-web.js.
@denikaryadi what file is this?
@noobsmatr619 what folder?
@MoudiZd I didn't understand your solution or workaround, I'm just trying to start whatsapp without issues.
from whatsapp-web.js.
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.
not work now
from whatsapp-web.js.
Related Issues (20)
- Video send is not working (remote cache verion: 2.2407.3)
- Unable to login. The qr is not working
- Login with phone number. HOT 1
- QR Code is not working in Ubuntu Platform HOT 22
- After scanning the QR code it will return the new QR code HOT 9
- Not able to generate QR more than two times HOT 2
- Whatsapp does not initialize after QR Code HOT 3
- Error [TypeError]: Cannot read properties of undefined (reading 'default') HOT 1
- After using webcashe HOT 1
- Error: Evaluation failed: TypeError: Cannot read properties of undefined (reading 'default') | at __puppeteer_evaluation_script__:5:95 HOT 4
- Client not connect HOT 9
- Getting error after loading from session or scanning QR HOT 1
- redirect after client.on('authenticated') HOT 2
- No longer working, what is happenning my friends? HOT 1
- const version = indexHtml.match(/manifest-([\d\\.]+)\.json/)[1]; HOT 2
- The example code is not reproducible HOT 2
- Sending message not working with new contacts HOT 1
- window.store.queryexist Exodus
- Delete message with webpack-exodus
- Not able to scan QR code HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from whatsapp-web.js.