whatsapp-web.js
whatsapp-web.js copied to clipboard
lost authentication after restart
Is there an existing issue for this?
- [X] I have searched the existing issues
Describe the bug
when I restart my node program, I very often (80%) lose authentication. I use "LocalAuth" and create a backup of the "dataPath" every 30 min. If a QR code scan is requested after the restart, I restore a backup, but this only works 5% of the time. I use docker and already have the "dataPath" stored inside the container or outside, no difference.
here is a screenshot after the restart https://i.imgur.com/dDTNvEt.png
Is there a better way to log what's happening?
GOOGLE-VM docker "node:16" node runs with pm2
Expected behavior
a connected WhatsAppWeb after restarting the node program
Steps to Reproduce the Bug or Issue
- docker node:16
- puppeteer 19.7.5
- whatsapp-web.js 1.19.5
- conntect via LocalAuth
- restart the node-application
Relevant Code
No response
Browser Type
Chromium
WhatsApp Account Type
WhatsApp Business
Does your WhatsApp account have multidevice enabled?
Yes, I am using Multi Device
Environment
OS: Linux Docker node:16 Phone: Android or iPhone (i have multiple WhatsApp Accounts, its happen on both devices) whatsapp-web.js: 1.19.5 WhatsApp Web version: 2.2316.6 nodejs: 16
Additional context
No response
console log:
Another connection wants to delete database 'wawc'. Closing db now to resume the delete request.
我也是
Probably as you are using docker and on every restart your data folder may gets deleted. You mentioned you take backups every 30min. But that seems not a good choice. As contents of session data files may change every few minutes. And if main files or tokens changes inside data folder. And if u are dumping old session data files back, most of the times it may simply log you out, as your session files mismatch.
So try to use data folder from outside docker and make it a persistent storage folder which do not overwrite on docker restart.
same here, after use LocalAuth correctly, If I need to recover the session to send more messages, it starts generating the QR codes again (this didn't happen before) and the "ready" event is not emitted
I really tried a lot, mounted volume, internal volume, delete meta-data, but what worked for me now is: "chmod 777 -R /whats-app-session-folder" (before initial client)
I really tried a lot, mounted volume, internal volume, delete meta-data, but what worked for me now is: "chmod 777 -R /whats-app-session-folder" (before initial client)
tried it didn't work :(
Same happen to me, running this on Windows environment
Hello, Having this same problem with docker. I'm using remote client to store de data with a mongoDB in the cloud
const client = new Client({
authStrategy: new RemoteAuth({
store: store,
backupSyncIntervalMs: 300000,
clientId: sessionName,
dataPath: process.env.BOT_DATAPATH ? process.env.BOT_DATAPATH : './data/',
}),
restartOnAuthFail: true,
puppeteer: {
headless: true,
args: [
'--no-sandbox',
// other node args
],
},
});
it works when I switch between laptops or pc locally but not with docker, it even works when I save the session via docker and then open it local but it doesn't restore authentication in docker for me, any idea of how to fix it ?
What is your CPU and RAM usege?
@Julzk Is still relevant?
no i solved it by use 2 cpus and 8gb ram in google cloud.