Open andresmv94 opened 1 year ago
@Avivbens, I tried but it didn't made it. Can you share the whatsapp-web.js version? Did you change the puppeteer version? Any help is very welcome.
@Avivbens, I tried but it didn't made it. Can you share the whatsapp-web.js version? Did you change the puppeteer version? Any help is very welcome.
Sure man 👍
Here are my deps versions:
@eduardotorresdev BTW, let the connection to establish for a minute or two...
You'll see on your WhatsApp client over the device that your chats are in sync. Keep it that way for a bit, then test the restart.
@Avivbens It's worked! Thank you. I just waited the time for WhatsApp client sync with device and, that's it, worked like charm.
@Avivbens It's worked! Thank you. I just waited the time for WhatsApp client sync with device and, that's it, worked like charm.
Happy to hear 🥳
For future documentation - list here the versions you're on please 🙏
I'm using whatsapp-web.js at "^1.23.0" version. I didn't changed puppeteer version or of any related package to wwebjs lib. I just added the webVersion that you told previously.
@Avivbens Can i colaborate with something? I believe that is very important to documentate all this question of auth and his persistance, so maybe we can do this together.
@Avivbens Can i colaborate with something? I believe that is very important to documentate all this question of auth and his persistance, so maybe we can do this together.
Well, that is a good idea. Personally, I find GitHub issues part of the documentation, but we might add it into the official docs for such an important thing.
That being said, the documentation structure of this project isn't in its best shape. The current documentation site is being generated by JsDocs, but I cannot see the content anywhere in the repo.
Maybe the owner can give us a hint here 👼
@pedroslopez
OK, I've managed to resolve the issue:
TL;DR Set the
webVersion
to2.2306.7
NestJS provider
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 }, }
Terminal Screenshot
It doesn't help, it works for one week and then suddenly it disconnects and asks for qr again on restore with no reason.. how can we fix this?? why it's happening?
OK, I've managed to resolve the issue: TL;DR Set the
webVersion
to2.2306.7
NestJS provider
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 }, }
Terminal Screenshot
It doesn't help, it works for one week and then suddenly it disconnects and asks for qr again on restore with no reason.. how can we fix this?? why it's happening?
Well, in general, the library has an Apache license, meaning it has no responsibility for the stability of the product. I can just assume that Whatsapp servers can revoke client authentication based on its behavior.
That being said, you can try to use the RemoteAuth strategy, it might be a bit more stable.
Hello every one.. is there a solution here? It is so frustrating.. It still happens..
Same problem
up
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.