Open justoverclockl opened 4 months ago
any solution?
any solution?
note yet, i have same problem
any solution?
Try This. Open Constants.js
at util
folder, change this code
WebVersion : 2.2410.1, webVersionCache : { type : 'local' },
With This
webVersion: '2.2410.1', webVersionCache: { type: 'remote', remotePath : 'https://raw.githubusercontent.com/wppconnect-team/wa-version/main/html/2.2410.1.html', },
try this ,its working on windows
webVersion: '2.2322.15', webVersionCache: { type: 'remote', remotePath: 'https://raw.githubusercontent.com/wppconnect-team/wa-version/main/html/2.2412.54.html',
I deleted all my messages and it didn't give any more errors
try this ,its working on windows
webVersion: '2.2322.15', webVersionCache: { type: 'remote', remotePath: 'https://raw.githubusercontent.com/wppconnect-team/wa-version/main/html/2.2412.54.html',
not work at all...same error for me
try this ,its working on windows
webVersion: '2.2322.15', webVersionCache: { type: 'remote', remotePath: 'https://raw.githubusercontent.com/wppconnect-team/wa-version/main/html/2.2412.54.html',
This version work for me, i was receving the error: "Node with given id does not belong to the document" When i checked the Constants.js file it was using the version "2.2410.1", Looking on "https://github.com/wppconnect-team/wa-version/tree/main/html", looks like this versions is not maintened anymore. Change to this new version works fine. However, it is a bit annoying to have to check the versions frequently, but at the moment it is working now!
Why closed????????
No response as always.....what a policy
anyone can fix it?
anyone can fix it?
no one will take care of issues (this is my experience so far). So maybe you need to wait for another version that address this (if you're lucky).
If this can help you this happen to me when i migrate to exodus...previous versions works....(for now)
anyone can fix it?
anyone can fix it?
I was able to resolve it by clearing all messages from the app on my phone
Modify the logout() function in your Client.js as follows:
async logout() {
await this.pupPage.evaluate(() => {
return window.Store.AppState.logout();
});
await this.pupPage.waitForFunction(() => !(window.Store.isLogoutInProgress), { timeout: 20000 });
let maxDelay = 0;
while (this.pupBrowser.isConnected() && (maxDelay < 10)) { // waits a maximum of 1 second before calling the AuthStrategy
await new Promise(resolve => setTimeout(resolve, 100));
maxDelay++;
}
await this.authStrategy.logout();
}
For more details see: https://github.com/pedroslopez/whatsapp-web.js/pull/2661/commits/6d68da43ee1a327c88bc8f1c770794bcd9324ea9
I think the problem is here: https://github.com/pedroslopez/whatsapp-web.js/blob/cd566f28b9957d58dbd470470f6e2fe018808db3/src/Client.js#L345
Why the logout function delete the user folder without close the browser before?
I have the same problem did anyone get the fix?
This is somehow related to #3173
When you log out, you will notice the ready
event is being fired and according to the issue, the authenticated
event is also being fired
Temporary Fix for Preventing User Session Deletion on Logout
For those experiencing issues with user sessions being deleted upon logout in whatsapp-web.js, you can implement a temporary fix by modifying the LocalAuth.js file.
Open the file located at:
node_modules\whatsapp-web.js\src\authStrategies\LocalAuth.js
Comment Out Session Deletion Code
Find the logout method and comment out the code that deletes the session folder:
async logout() {
// if (this.userDataDir) {
// await fs.promises.rm(this.userDataDir, { recursive: true, force: true })
// .catch((e) => {
// throw new Error(e);
// });
// }
console.log('==========> logout');
}
Delete Session Folder Manually on Disconnected EventInstead of deleting the session folder on logout, delete it when a disconnected event is fired with the conditions reason == 'NAVIGATION' || reason == 'LOGOUT'.
Add the following code to handle the disconnected event:
client.on("disconnected", async (reason) => {
await client.destroy();
if (reason == 'NAVIGATION' || reason == 'LOGOUT') {
const folderPath = path.join(__dirname, `../../../.wwebjs_auth/session-${userId}`);
fs.rm(folderPath, { recursive: true, force: true }, (err) => {
if (err) {
console.log(`Error deleting folder: ${err.message}`);
} else {
console.log('Folder deleted successfully');
}
});
}
});
This will prevent the session folder from being deleted automatically on logout and will ensure it is deleted only when necessary.
Temporary Fix for Preventing User Session Deletion on Logout
For those experiencing issues with user sessions being deleted upon logout in whatsapp-web.js, you can implement a temporary fix by modifying the LocalAuth.js file.
Open the file located at:
node_modules\whatsapp-web.js\src\authStrategies\LocalAuth.js
Comment Out Session Deletion Code
Find the logout method and comment out the code that deletes the session folder:
async logout() { // if (this.userDataDir) { // await fs.promises.rm(this.userDataDir, { recursive: true, force: true }) // .catch((e) => { // throw new Error(e); // }); // } console.log('==========> logout'); }
Delete Session Folder Manually on Disconnected EventInstead of deleting the session folder on logout, delete it when a disconnected event is fired with the conditions reason == 'NAVIGATION' || reason == 'LOGOUT'.
Add the following code to handle the disconnected event:
client.on("disconnected", async (reason) => { await client.destroy(); if (reason == 'NAVIGATION' || reason == 'LOGOUT') { const folderPath = path.join(__dirname, `../../../.wwebjs_auth/session-${userId}`); fs.rm(folderPath, { recursive: true, force: true }, (err) => { if (err) { console.log(`Error deleting folder: ${err.message}`); } else { console.log('Folder deleted successfully'); } }); } });
This will prevent the session folder from being deleted automatically on logout and will ensure it is deleted only when necessary.
please how to get ${userId} ?
Temporary Fix for Preventing User Session Deletion on Logout For those experiencing issues with user sessions being deleted upon logout in whatsapp-web.js, you can implement a temporary fix by modifying the LocalAuth.js file. Open the file located at: node_modules\whatsapp-web.js\src\authStrategies\LocalAuth.js Comment Out Session Deletion Code Find the logout method and comment out the code that deletes the session folder:
async logout() { // if (this.userDataDir) { // await fs.promises.rm(this.userDataDir, { recursive: true, force: true }) // .catch((e) => { // throw new Error(e); // }); // } console.log('==========> logout'); }
Delete Session Folder Manually on Disconnected EventInstead of deleting the session folder on logout, delete it when a disconnected event is fired with the conditions reason == 'NAVIGATION' || reason == 'LOGOUT'. Add the following code to handle the disconnected event:
client.on("disconnected", async (reason) => { await client.destroy(); if (reason == 'NAVIGATION' || reason == 'LOGOUT') { const folderPath = path.join(__dirname, `../../../.wwebjs_auth/session-${userId}`); fs.rm(folderPath, { recursive: true, force: true }, (err) => { if (err) { console.log(`Error deleting folder: ${err.message}`); } else { console.log('Folder deleted successfully'); } }); } });
This will prevent the session folder from being deleted automatically on logout and will ensure it is deleted only when necessary.
please how to get ${userId} ?
basically here userId is clientId.
authStrategy: new LocalAuth({
clientId: userId,
}),
use your clientId instead of it.
This is still happening on 1.2.6...
It seems like the lib is calling logout on page change, which means its trying to delete puppeteer' data while the browser is still open, which causes the error...
I guess one option would be to stop the browser, call logout and then start it all over again!?
Is there an existing issue for this?
Describe the bug
N.B. this not happen with previous versions of WWEBJS...happen with exodus package
I can get the qrcode and pairing code correctly, but after a qrcode scan i get
this is my client:
Expected behavior
as previous versions, i shouldn't get this error and the phone will be paired correctly.
Steps to Reproduce the Bug or Issue
Relevant Code
seems that the problem is here (based on che stack error)
async logout() { if (this.userDataDir) { await fs.promises.rm(this.userDataDir, { recursive: true, force: true }) .catch((e) => { throw new Error(e); }); } }
Browser Type
Chromium
WhatsApp Account Type
WhatsApp Business
Does your WhatsApp account have multidevice enabled?
No, I am not using Multi Device
Environment
OS: Windows whatsapp-web.js version: "whatsapp-web.js": "github:pedroslopez/whatsapp-web.js#webpack-exodus" node version: 18.17.1 and 20.12.2
Additional context
No response