Open CHR-onicles opened 2 years ago
I fix the problem installing nodejs version 18.14.2 with the npm version 9.5.0.
ps: I use remote auth with MongoDB in a Docker Container
I'm facing the same issue here
It seems like a race condition when the client don't wait to the zip file to be downloades/extracted
Any updates on these?
A few people tested @nkbhasker PR and it seems is working fine.
Any updates on when this wil be merged?
@viniciusbig I am having the same problem in the same environment as you. Were you able to solve the issue?
Thanks!!
@viniciusbig I am having the same problem in the same environment as you. Were you able to solve the issue?
Thanks!!
I've created a post-install script to replace RemoteAuth.js
file with the same changes in the @nkbhasker PR
Also, yuou need to install adm-zip
for this to work.
This is a temporary solution for this problem. Hopping that this PR will be merged soon
@viniciusbig I am having the same problem in the same environment as you. Were you able to solve the issue? Thanks!!
I've created a post-install script to replace
RemoteAuth.js
file with the same changes in the @nkbhasker PRAlso, yuou need to install
adm-zip
for this to work.This is a temporary solution for this problem. Hopping that this PR will be merged soon
@viniciusbig You Rock!!
Any updates on when this wil be merged?
I solved this issue by using the same IP location of the registered phone number for whatsapp. For example my number is an Indian number and am using Indian local VPS.
I've founded a solution and no more qrcode is issued to active connections on RemoteAuth strategy.
const { Client, RemoteAuth } = require('whatsapp-web.js');
// Require database
const { MongoStore } = require('wwebjs-mongo');
const mongoose = require('mongoose');
// Load the session data
mongoose.connect(process.env.MONGODB_URI).then( async () => {
const store = new MongoStore({ mongoose: mongoose });
// here check if sesssion exists (Replace 'MyInstanceID' by yourself instance id)
const hasSession = await store.sessionExists({session: 'MyInstanceID'})
// if exists so load to store resource current connection
if(hasSession){
await store.extract({session: 'MyInstanceID'});
}
const client = new Client({
authStrategy: new RemoteAuth({
store: store,
// don't forget pass this property 'clientId' to multidevice connections
clientId: 'MyInstanceID',
backupSyncIntervalMs: 300000
})
});
//if remote stored connection still alive no qrcode will be prompted.
client.initialize();
});
Saya telah menemukan solusi dan tidak ada lagi kode qr yang dikeluarkan untuk koneksi aktif pada strategi RemoteAuth.
const { Client, RemoteAuth } = require('whatsapp-web.js'); // Require database const { MongoStore } = require('wwebjs-mongo'); const mongoose = require('mongoose'); // Load the session data mongoose.connect(process.env.MONGODB_URI).then( async () => { const store = new MongoStore({ mongoose: mongoose }); // here check if sesssion exists (Replace 'MyInstanceID' by yourself instance id) const hasSession = await store.sessionExists({session: 'MyInstanceID'}) // if exists so load to store resource current connection if(hasSession){ await store.extract({session: 'MyInstanceID'}); } const client = new Client({ authStrategy: new RemoteAuth({ store: store, // don't forget pass this property 'clientId' to multidevice connections clientId: 'MyInstanceID', backupSyncIntervalMs: 300000 }) }); //if remote stored connection still alive no qrcode will be prompted. client.initialize(); });
Not work with error
Error: ENOENT: no such file or directory, open 'D:\01Project\03LAINNYA\apiwa\MyInstanceID.zip'
I fixed it in an official/recommended way on this commit: https://github.com/pedroslopez/whatsapp-web.js/pull/3200 Encourage maintainers to approve the PR.
While the PR is not approved, you can use my fork like this:
npm install github:bymarcelo/whatsapp-web.js#fix-remote-auth-unzip
NOTE: Recommended to use node version >= 18, tested v20
Is there an existing issue for this?
Describe the bug
After running for about 6-7 days, it appears the session saved in mongodb expires, prompting a QRcode scan in heroku. This has happened consistently for the past 3 weeks, and sometimes scanning doesn't work; so I have to manually delete the session saved in my mongo database, rescan and wait for remote auth to save the session, after which it works perfectly, but again just for a week.
Expected behavior
QRcode should not appear, and session should restore itself continuously
Steps to Reproduce the Bug or Issue
Relevant Code
No response
Browser Type
Chromium
WhatsApp Account Type
Standard
Does your WhatsApp account have multidevice enabled?
Yes, I am using Multi Device
Environment
OS: Linux, the bug occurs on Heroku's dynos which run Linux but my OS is Win 10 and there are no local problems Phone OS: Android Whatsapp-web.js: v1.17.1 Whatsapp web: v2.2232.8 Node.js: v18.7.0
Additional context
No response