wechaty / puppet-whatsapp

Wechaty Puppet for Whatsapp
https://npmjs.com/package/wechaty-puppet-whatsapp
Apache License 2.0
24 stars 17 forks source link

Error after scan the qrcode (scaned by a multi-device enabled whatsapp account) #331

Closed huan closed 2 years ago

huan commented 2 years ago
22:00:50 ERR WhatsAppManager start() whatsapp.initialize() rejection: Error: Evaluation failed: TypeError: Cannot read properties of undefined (reading 'Socket')
    at __puppeteer_evaluation_script__:6:62

Does this mean that the multi-device enabled account is not supported?

su-chang commented 2 years ago

Does this mean that the multi-device enabled account is not supported?

Yes, you are right. MD will be enabled in the next step.

su-chang commented 2 years ago

22:00:50 ERR WhatsAppManager start() whatsapp.initialize() rejection: Error: Evaluation failed: TypeError: Cannot read properties of undefined (reading 'Socket') at puppeteer_evaluation_script:6:62

This error log is due to a bug which in whatsapp-web.js, see: https://github.com/pedroslopez/whatsapp-web.js/issues/1242 and https://github.com/pedroslopez/whatsapp-web.js/pull/1249

I will fix it now by upgrade the dependence.

huan commented 2 years ago

Thank you very much for the explanation and the fixing!

huan commented 2 years ago

Update: whatsappweb.js@1.16 supports Multi Device

See: https://github.com/pedroslopez/whatsapp-web.js/releases/tag/v1.16.0

Error: Authenticating via JSON session is not supported for MultiDevice-enabled WhatsApp accounts

However, I got the above error message because of the below change:

the old way of passing session as a client option is now deprecated.

By trying to use the official whatsappweb.js to replace the @juzi.bot/whatsappweb.js

$ pwd
/home/huan/git/wechaty/getting-started
$ npm i whatsapp-web.js
$ cd node_modules/@juzi.bot/
$ ls
whatsapp-web.js
$ whatsapp-web.js whatsapp-web.js.bak
$ ln -s ../whatsapp-web.js .
$ ls -l
lrwxrwxrwx 1 huan huan   18 Apr  6 13:14 whatsapp-web.js -> ../whatsapp-web.js
drwxrwxr-x 3 huan huan 4096 Mar 29 13:53 whatsapp-web.js.bak
$ cd ../..
$ ls
data                            dist  examples  Makefile      NOTICE        package-lock.json  tests  tsconfig.json
ding-dong-bot.memory-card.json  docs  LICENSE   node_modules  package.json  README.md          t.js   t.ts
$ npm run start:whatsapp:web
...
13:14:40 ERR PuppetWhatsApp Manager start() whatsapp.initialize() rejection: Error: Authenticating via JSON session is not supported for MultiDevice-enabled WhatsApp accounts.
huan commented 2 years ago

With the help from @hcfw007

wechaty-puppet-whatsapp@1.15.7 has supported Multi Devices accounts.

Cheers!

su-chang commented 2 years ago

@huan Thank you for your feedback, and I will upgrade wechaty-puppet-whatsapp@1.15.7 to be the latest version, and then it will not confuse others any more.