whatsapp-web.js icon indicating copy to clipboard operation
whatsapp-web.js copied to clipboard

fix remote auth

Open nkbhasker opened this issue 2 years ago • 27 comments

PR Details

Remote auth session not getting restored.

Description

Related Issue

closes #2038, closes #1681, closes #2452

Motivation and Context

How Has This Been Tested

  1. Mongo Store - This was tested with Mongo store as described in the documentation.
  2. AWS S3 Store - I have also tested this with a new s3 store.

Types of changes

  • [x] Dependency change
  • [x] Bug fix (non-breaking change which fixes an issue)
  • [ ] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • [x] My code follows the code style of this project.
  • [ ] I have updated the documentation accordingly (index.d.ts).

nkbhasker avatar Aug 17 '23 16:08 nkbhasker

It don't work for me too. I can't restore the session from remote auth using mongo lib, after the whatsapp version 2.2334.12

flaviobogila avatar Aug 22 '23 16:08 flaviobogila

@nkbhasker Why dou you think that the problem was the unzipper package? I have a server running with 34 devices under RemoteAuth, I have a issue where only ~30% of the sessions are restored after restarts. I tested your solution and my results are the same as before. I also tested locally with 2 devices and with both adm-zip and unzipper it worked the same. In my opinion there is something else causing problems with RemoteAuth. I am trying to debug it and will be happy to bring a feedback, but I would like to hear from you why you think that changing the unzip package could solve the problem! Thanks for contributing!

mrfelipemartins avatar Aug 23 '23 13:08 mrfelipemartins

@nkbhasker Why dou you think that the problem was the unzipper package? I have a server running with 34 devices under RemoteAuth, I have a issue where only ~30% of the sessions are restored after restarts. I tested your solution and my results are the same as before. I also tested locally with 2 devices and with both adm-zip and unzipper it worked the same. In my opinion there is something else causing problems with RemoteAuth. I am trying to debug it and will be happy to bring a feedback, but I would like to hear from you why you think that changing the unzip package could solve the problem! Thanks for contributing!

I have tested the solution its working. I have tested the unzipping with unzipper. That's not properly unzipping the file. That's lead not to restore the session. Things completely got changed with using adm-zip and unzipper. If you merge the commit, it would be helpful for alll to use the library.

OptiMus-cyber-2 avatar Sep 04 '23 04:09 OptiMus-cyber-2

@nkbhasker Why dou you think that the problem was the unzipper package? I have a server running with 34 devices under RemoteAuth, I have a issue where only ~30% of the sessions are restored after restarts. I tested your solution and my results are the same as before. I also tested locally with 2 devices and with both adm-zip and unzipper it worked the same. In my opinion there is something else causing problems with RemoteAuth. I am trying to debug it and will be happy to bring a feedback, but I would like to hear from you why you think that changing the unzip package could solve the problem! Thanks for contributing!

I have tested the solution its working. I have tested the unzipping with unzipper. That's not properly unzipping the file. That's lead not to restore the session. Things completely got changed with using adm-zip and unzipper. If you merge the commit, it would be helpful for alll to use the library.

May you give the option for unzipping as parameter in Remoteauth.

OptiMus-cyber-2 avatar Sep 04 '23 04:09 OptiMus-cyber-2

@nkbhasker Why dou you think that the problem was the unzipper package? I have a server running with 34 devices under RemoteAuth, I have a issue where only ~30% of the sessions are restored after restarts. I tested your solution and my results are the same as before. I also tested locally with 2 devices and with both adm-zip and unzipper it worked the same. In my opinion there is something else causing problems with RemoteAuth. I am trying to debug it and will be happy to bring a feedback, but I would like to hear from you why you think that changing the unzip package could solve the problem! Thanks for contributing!

Ye, I think the problem might be the save interval instead of unzipper

tuyuribr avatar Sep 04 '23 14:09 tuyuribr

Fix: Resolve issue by downgrading Node.js version, removing old dependencies, and reinstalling

The problem was caused by using Node.js version 18, which caused compatibility issues with the project. After downgrading to Node.js version 16, removing old dependencies (old 'node_modules' directory and 'package-lock.json'), and reinstalling dependencies with 'npm install,' the issue is now resolved.

  • Changed Node.js version from 18 to 16.
  • Removed the old 'node_modules' directory and 'package-lock.json' file.
  • Ran 'npm install' to reinstall project dependencies.

bmmangukiya avatar Sep 06 '23 07:09 bmmangukiya

will this ever be merged or fixed? RemoteAuth is pretty essential feature

downgrading node is simply not a solution

longgtruong avatar Sep 29 '23 10:09 longgtruong

@pedroslopez can you take a look on that please?

thereis avatar Nov 20 '23 23:11 thereis

This fix actually worked for me. What @nkbhasker mention is possible. But I'm not really sure about the specific reason why the uncompression for unzipper doesn't work and works for adm.

GT-Eric avatar Nov 23 '23 02:11 GT-Eric

I've tested this combined with this library: https://github.com/Tots-Agency/wwebjs-google-cloud-storage and this is working.

klmz avatar Jan 12 '24 13:01 klmz

test work

gg3083 avatar Jan 23 '24 10:01 gg3083

It seems to be working now. any change to have this merged?

viniciusbig avatar Jan 24 '24 19:01 viniciusbig

Works perfectly, but... in case you will start another logged session in other server.. then it cause to messages stop sending. The only fix for this is to delete the folder from the S3.

roysG avatar Jan 26 '24 06:01 roysG

@pedroslopez will this ever be merged or fixed? Yes, @longgtruong RemoteAuth is a pretty essential feature @pedroslopez please 🙏 look into it

ravikant-pal avatar Feb 06 '24 13:02 ravikant-pal

Yay, it works perfectly with the wwebjs-aws-s3 extension and node18, it would be of utmost importance to approve the PR to avoid the patch 🙌

outaTiME avatar Feb 13 '24 20:02 outaTiME

This worked perfectly for me, using the wwebjs-mongo extension.

zanatahenry avatar Feb 23 '24 11:02 zanatahenry

adm zip loads up too much memory when i restart it was stuck at remote connected, hopefully I do not see QR code but the problem is the zipper

I'm using node version 20.11.1

Har1ha avatar Mar 29 '24 20:03 Har1ha

https://github.com/pedroslopez/whatsapp-web.js/issues/2631#issuecomment-2028152897

edmilson-dk avatar Mar 30 '24 15:03 edmilson-dk

Doesnt work for me.

JuanSpada avatar May 28 '24 15:05 JuanSpada

Doesnt work for me.

Could you specify what exactly, what is the error do you have?

allburov avatar May 30 '24 02:05 allburov

Working for me. yarn remove whatsapp-web.js yarn add nkbhasker/whatsapp-web.js#fix-remote-auth

murtraja avatar Jun 05 '24 02:06 murtraja

Unfortunately, adm-zip doesn't support zip files larger than 2 gb

RangeError: File size (2561706669) is greater than 2 GiB
at new NodeError (node:internal/errors:405:5)
 at tryCreateBuffer (node:fs:430:13)
at Object.readFileSync (node:fs:475:14)
at new module.exports (./node_modules/adm-zip/adm-zip.js:55:37)
[...]

themazim avatar Jun 17 '24 16:06 themazim