Open andresmv94 opened 1 year ago
I am experiencing the same problem. I have been using it for a few weeks without a problem and since yesterday it has been disconnecting me often and it does not notify me why it happens. Anyone else with this error?
The whatsapp version that whatsapp-web.js mark like "working with" is = WhatsApp_Web 2.2306.7, and Now the current WhatsApp Web version is 2.2317.10. maybe something with session was changed
I am experiencing the same problem. I have been using it for a few weeks without a problem and since yesterday it has been disconnecting me often and it does not notify me why it happens. Anyone else with this error?
The whatsapp version that whatsapp-web.js mark like "working with" is = WhatsApp_Web 2.2306.7, and Now the current WhatsApp Web version is 2.2317.10. maybe something with session was changed
I am experiencing the same problem. I have been using it for a few weeks without a problem and since yesterday it has been disconnecting me often and it does not notify me why it happens. Anyone else with this error?
Pudiste encontar solucion??
At first I found a solution, for now it's working. In the package.json inside node_modules/whatsapp-web... change the version of puppeteer to 18.1.0
At first I found a solution, for now it's working. In the package.json inside node_modules/whatsapp-web... change the version of puppeteer to 18.1.0
Is weird because that works some times
same here
Same here
benjachiban
I tried it, didn't work
Same problem change the version of puppeteer to 18.1.0 dont work
@pedroslopez , some idea about this?
same here
same here :(
At first I found a solution, for now it's working. In the package.json inside node_modules/whatsapp-web... change the version of puppeteer to 18.1.0
It worked for me, update puppeteer to 20.3.0
At first I found a solution, for now it's working. In the package.json inside node_modules/whatsapp-web... change the version of puppeteer to 18.1.0
It worked for me, update puppeteer to 20.3.0
Please fulls steps. I need a npm install then?
My puppeteer is on version 20.3.0 but the error persists.
@pedroslopez Maybe your help?
up
UP, session persistence is super unconsistent.
same problem
I had the same problem with session in another library, it seems this problem is related to some thing that Whatsapp changed. Maybe it's a false impression I've tested different libraries.
Hi, I resolved it with permission chmod on both .wwebjs_auth and .wwebjs_cache directories
regards
Hi, I resolved it with permission chmod on both .wwebjs_auth and .wwebjs_cache directories
regards chmod 777 .wwebjs_cache
still ask to scan qr code
up again
still happening
every restart localauth not working , and send new QR, any solution to this?
every restart localauth not working , and send new QR, any solution to this?
Have you tried the solutions mentioned above? Try updating Puppeteer to version 20.3.0 in Node_modules/whatsapp-web.js/package.json and then run 'npm update'. This worked for me.
This is how i fix this issue:
1/ make sure .wwebjs_auth is created after login, otherwise likely your code problem 2/ puppeteer is update 3/ make sure .wwebjs_auth is chmod 777
why this is closed if actually not work?
the solution is to wait a couple minutes after the first qr code scan to let the session be "populated" properly
also as mentioned here the session is being saved in .wwebjs_auth
, so make sure that folder is created properly
I scan the qrcode, I get the qrcode, authentications is fineโฆif after 2 hour I restart the server I need to rescan qrcode, so itโs not a problem related to โwait some minutesโ
i've managed this and seems to work but i get
ProtocolError: Waiting for selector `[data-icon='search']` failed: Runtime.callFunctionOn timed out. Increase the 'protocolTimeout' setting in launch/connect calls for a higher timeout if needed.
1|app | at <instance_members_initializer> (/var/www/node_modules/whatsapp-web.js/node_modules/puppeteer-core/lib/cjs/puppeteer/common/CallbackRegistry.js:86:14)
1|app | at new Callback (/var/www/node_modules/whatsapp-web.js/node_modules/puppeteer-core/lib/cjs/puppeteer/common/CallbackRegistry.js:90:16)
1|app | at CallbackRegistry.create (/var/www/node_modules/whatsapp-web.js/node_modules/puppeteer-core/lib/cjs/puppeteer/common/CallbackRegistry.js:22:26)
1|app | at Connection._rawSend (/var/www/node_modules/whatsapp-web.js/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/Connection.js:80:26)
1|app | at CdpCDPSession.send (/var/www/node_modules/whatsapp-web.js/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/CDPSession.js:66:33)
1|app | at #evaluate (/var/www/node_modules/whatsapp-web.js/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/ExecutionContext.js:201:50)
1|app | at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
1|app | at async ExecutionContext.evaluateHandle (/var/www/node_modules/whatsapp-web.js/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/ExecutionContext.js:168:16)
1|app | at async IsolatedWorld.evaluateHandle (/var/www/node_modules/whatsapp-web.js/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/IsolatedWorld.js:115:16)
1|app | at async CdpJSHandle.evaluateHandle (/var/www/node_modules/whatsapp-web.js/node_modules/puppeteer-core/lib/cjs/puppeteer/api/JSHandle.js:150:20)
1|app | at async WaitTask.rerun (/var/www/node_modules/whatsapp-web.js/node_modules/puppeteer-core/lib/cjs/puppeteer/common/WaitTask.js:103:28)
i've managed this and seems to work but i get
ProtocolError: Waiting for selector `[data-icon='search']` failed: Runtime.callFunctionOn timed out. Increase the 'protocolTimeout' setting in launch/connect calls for a higher timeout if needed. 1|app | at <instance_members_initializer> (/var/www/node_modules/whatsapp-web.js/node_modules/puppeteer-core/lib/cjs/puppeteer/common/CallbackRegistry.js:86:14) 1|app | at new Callback (/var/www/node_modules/whatsapp-web.js/node_modules/puppeteer-core/lib/cjs/puppeteer/common/CallbackRegistry.js:90:16) 1|app | at CallbackRegistry.create (/var/www/node_modules/whatsapp-web.js/node_modules/puppeteer-core/lib/cjs/puppeteer/common/CallbackRegistry.js:22:26) 1|app | at Connection._rawSend (/var/www/node_modules/whatsapp-web.js/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/Connection.js:80:26) 1|app | at CdpCDPSession.send (/var/www/node_modules/whatsapp-web.js/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/CDPSession.js:66:33) 1|app | at #evaluate (/var/www/node_modules/whatsapp-web.js/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/ExecutionContext.js:201:50) 1|app | at process.processTicksAndRejections (node:internal/process/task_queues:95:5) 1|app | at async ExecutionContext.evaluateHandle (/var/www/node_modules/whatsapp-web.js/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/ExecutionContext.js:168:16) 1|app | at async IsolatedWorld.evaluateHandle (/var/www/node_modules/whatsapp-web.js/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/IsolatedWorld.js:115:16) 1|app | at async CdpJSHandle.evaluateHandle (/var/www/node_modules/whatsapp-web.js/node_modules/puppeteer-core/lib/cjs/puppeteer/api/JSHandle.js:150:20) 1|app | at async WaitTask.rerun (/var/www/node_modules/whatsapp-web.js/node_modules/puppeteer-core/lib/cjs/puppeteer/common/WaitTask.js:103:28)
Check here https://github.com/pedroslopez/whatsapp-web.js/issues/2477
@amoyano thx, done but not work, the session seems to be restored but after a while i get the above error
this happen also on clientState. after few seconds become null @alechkos
0|app | ClientState: CONNECTED
1|app | ClientState: null
1|app | ClientState: null
this is the complete log
0|app | Server started on port 3030
0|app | Connected to db
0|app | Whatsapp Authenticated
0|app | Client ready
0|app | ClientState: CONNECTED
0|app | ClientState: CONNECTED
0|app | ClientState: null
0|app | ClientState: null
0|app | ClientState: CONNECTED
1|app | ClientState: null
1|app | You have triggered an unhandledRejection, you may have forgotten to catch a Promise rejection:
1|app | ProtocolError: Waiting for selector `div[role='textbox']` failed: Runtime.callFunctionOn timed out. Increase the 'protocolTimeout' setting in launch/connect calls for a higher timeout if needed.
1|app | at <instance_members_initializer> (/var/www/node_modules/whatsapp-web.js/node_modules/puppeteer-core/lib/cjs/puppeteer/common/CallbackRegistry.js:86:14)
1|app | at new Callback (/var/www/node_modules/whatsapp-web.js/node_modules/puppeteer-core/lib/cjs/puppeteer/common/CallbackRegistry.js:90:16)
1|app | at CallbackRegistry.create (/var/www/node_modules/whatsapp-web.js/node_modules/puppeteer-core/lib/cjs/puppeteer/common/CallbackRegistry.js:22:26)
1|app | at Connection._rawSend (/var/www/node_modules/whatsapp-web.js/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/Connection.js:80:26)
1|app | at CdpCDPSession.send (/var/www/node_modules/whatsapp-web.js/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/CDPSession.js:66:33)
1|app | at #evaluate (/var/www/node_modules/whatsapp-web.js/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/ExecutionContext.js:201:50)
1|app | at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
1|app | at async ExecutionContext.evaluateHandle (/var/www/node_modules/whatsapp-web.js/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/ExecutionContext.js:168:16)
1|app | at async IsolatedWorld.evaluateHandle (/var/www/node_modules/whatsapp-web.js/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/IsolatedWorld.js:115:16)
1|app | at async CdpJSHandle.evaluateHandle (/var/www/node_modules/whatsapp-web.js/node_modules/puppeteer-core/lib/cjs/puppeteer/api/JSHandle.js:150:20)
1|app | at async WaitTask.rerun (/var/www/node_modules/whatsapp-web.js/node_modules/puppeteer-core/lib/cjs/puppeteer/common/WaitTask.js:103:28)
@justoverclockl
thx, done
Did you just change to const INTRO_IMG_SELECTOR = '[data-icon="search"]'
in your code as mentioned here?
If so you are not using the latest library version and you should apply this:
npm i github:pedroslopez/whatsapp-web.js#main
Also provide the code where you are handling the client state changes
i have github:pedroslopez/whatsapp-web.js#main @alechkos
const authStrategy = new LocalAuth({
clientId: "adminSession"
});
const client = new Client({
authStrategy,
restartOnAuthFail: true,
takeoverOnConflict: true,
puppeteer: {
headless: true,
args: ["--no-sandbox"],
}
});
client.initialize();
client.on("ready", () => {
console.log("Client pronto");
});
client.on("authenticated", () => {
console.log("Whatsapp ok");
});
client.on("disconnected", (reason) => {
console.log("Disconnected:", reason);
});
router.get("/whatsapp/auth", async (req, res) => {
const clientState = await client?.getState();
console.log('ClientState: ', clientState)
try {
if (clientState === "CONNECTED") {
return res.status(200).json({
message: "Login ok."
});
} else {
return res.status(200).json({
message: "Scan qrcode."
});
}
} catch (err) {
res.status(404).send({
error: "oops test error."
});
}
});
@justoverclockl
getState
is probably broken, check #2125
its not the only broken, i keep getting
ProtocolError: Waiting for selector `[data-icon="search"]` failed: Runtime.callFunctionOn timed out. Increase the 'protocolTimeout' setting in launch/connect calls for a higher timeout if needed.
0|app | at <instance_members_initializer> (/var/www/node_modules/whatsapp-web.js/node_modules/puppeteer-core/lib/cjs/puppeteer/common/CallbackRegistry.js:86:14)
0|app | at new Callback (/var/www/node_modules/whatsapp-web.js/node_modules/puppeteer-core/lib/cjs/puppeteer/common/CallbackRegistry.js:90:16)
0|app | at CallbackRegistry.create (/var/www/node_modules/whatsapp-web.js/node_modules/puppeteer-core/lib/cjs/puppeteer/common/CallbackRegistry.js:22:26)
0|app | at Connection._rawSend (/var/www/node_modules/whatsapp-web.js/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/Connection.js:80:26)
0|app | at CdpCDPSession.send (/var/www/node_modules/whatsapp-web.js/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/CDPSession.js:66:33)
0|app | at #evaluate (/var/www/node_modules/whatsapp-web.js/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/ExecutionContext.js:201:50)
0|app | at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
0|app | at async ExecutionContext.evaluateHandle (/var/www/node_modules/whatsapp-web.js/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/ExecutionContext.js:168:16)
0|app | at async IsolatedWorld.evaluateHandle (/var/www/node_modules/whatsapp-web.js/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/IsolatedWorld.js:115:16)
0|app | at async CdpJSHandle.evaluateHandle (/var/www/node_modules/whatsapp-web.js/node_modules/puppeteer-core/lib/cjs/puppeteer/api/JSHandle.js:150:20)
0|app | at async WaitTask.rerun (/var/www/node_modules/whatsapp-web.js/node_modules/puppeteer-core/lib/cjs/puppeteer/common/WaitTask.js:103:28)
i've tried with [data-icon="search"] , i tried also const INTRO_IMG_SELECTOR = 'div[role=\'textbox\']';...but nothing...please do not close issues this fast....
Same error.. Any solution
same for me. the library appears to have problems with multiple projects.
I have two projects:
when the client init is in the library project it cant restore the session, even if i directly specify it.
+1
WhatsApp-web.js suddenly logs out on restore session with no reason.. How to fix this?
WhatsApp-web.js suddenly logs out on restore session with no reason.. How to fix this?
@yairmelamed we need to wait for a fix...
same problem here!
+1
any news on that?
same here
At first I found a solution, for now it's working. In the package.json inside node_modules/whatsapp-web... change the version of puppeteer to 18.1.0
work for me, but some times fails
We really need some solution in here...
I'm willing to assist, just give me the details of the potential issue ๐
OK, I've managed to resolve the issue:
TL;DR
Set the webVersion
to 2.2306.7
export const WhatsappClientProvider: Provider<Client> = {
provide: WHATSAPP_CLIENT,
inject: [ConfigService],
useFactory: async (configService: ConfigService) => {
const logger: Logger = new Logger('WHATSAPP_CLIENT')
const env = configService.get<Envs>(EnvVariables.NODE_ENV, Envs.Production)
const args = env === Envs.Production ? ['--no-sandbox', '--disable-setuid-sandbox'] : undefined
const client = new Client({
authStrategy: new LocalAuth(),
webVersion: '2.2306.7', // this keeps the Whatsapp Verison with the latest version worked ๐
puppeteer: {
args,
},
})
client.once('qr', (qr) => {
logger.debug('QR code received, scan please')
return qrcode.generate(qr)
})
client.on('authenticated', () => {
logger.debug('Authenticated successfully!')
})
client.on('disconnected', (reason) => {
logger.error(`Disconnected, reason: ${reason}`)
})
const prm = new Promise<void>((resolve) =>
client.on('ready', async () => {
logger.debug('WhatsApp Client is ready!')
resolve()
}),
)
client.initialize()
await prm
return client
},
}
Is there an existing issue for this?
Describe the bug
I have been using "whatsapp-web.js" in my application for about 6 months, and yesterday the session persistence stopped working, I am using
authStrategy: new LocalAuth({ clientId: user._id })
, and with this When I want to use the WhatsApp channel again, I can use it without having to scan the QR again, but every time that I want to use the channel and send messages, it is making me to scan the QR and this was not happening until yesterdayExpected behavior
for first time scan the QR once, and be able to continue using whatsapp without having to scan each time I use it
Steps to Reproduce the Bug or Issue
authStrategy: new LocalAuth({ clientId: "some-client-id" })
Relevant Code
Browser Type
Google Chrome
WhatsApp Account Type
Standard
Does your WhatsApp account have multidevice enabled?
Yes, I am using Multi Device
Environment
Additional context
remember: this was not happening until yesterday, I already tried setting all the permissions to the .wwebjs_auth folder, and to all its content, but it's still the same, I also notice that in windows (no server -> my personal computer) with exactly the same configuration but using
CHROME_EXECUTABLE_PATH=C:/Program Files/Google/Chrome /Application/chrome.exe
, it is working correctly, any idea why?maybe the session files are not being saved correctly in the ".wwebjs_auth" folder, but I don't really know how to look at that part
Update: in other computer with Windows is happenig the same issue so is not the OS.