pedroslopez / whatsapp-web.js

A WhatsApp client library for NodeJS that connects through the WhatsApp Web browser app
https://wwebjs.dev
Apache License 2.0
15.39k stars 3.67k forks source link

Bot on ubuntu server does not connect after reading qrcode #1352

Closed mateuscolli closed 1 year ago

mateuscolli commented 2 years ago

Is there an existing issue for this?

Describe the bug

I'm trying to run the bot on a VPS Ubuntu Server, but after I scan the QRCODE it doesn't connect... I've already formatted the VPS, installed all the necessary dependencies to work on Ubuntu, I've tried to recreate the bot with nothing in it but the module whatsapp-web.js... If anyone can help me I would appreciate it :)

Expected behavior

I hope to be able to run the bot inside the Ubuntu VPS :)

Steps to Reproduce the Bug or Issue

Run the bot in Ubuntu Server

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

SO: Ubuntu 18 Phone OS: MUI whatsapp-web.js 1.16.4 WhatsApp Web version: 2.2208.14 Node.js 16.14.2

Additional context

No response

ainulhamdani commented 2 years ago

For Multi Device you have to scan the qrcode twice

IKallS commented 2 years ago

For Multi Device you have to scan the qrcode twice

I'm having the same problem as above. But how am I going to scan twice a QR that is generated only once?

Booitt commented 2 years ago

Have you tried clearing all chats on whatsapp before connecting? That's what works for me when that happens.

tdigitali commented 2 years ago

I have the same problem :( @IKallS

adityadhawan22 commented 2 years ago

I was having the same issue. Fixed it by remove the .wwebjs_auth folder

rm -rf .wwebjs_auth 
tdigitali commented 2 years ago

@adityadhawan22 , Excuse my ignorance, where is that directory

adityadhawan22 commented 2 years ago

@tdigitali - If you are using authStrategy as LocalAuth()

Then you can find the folder in the directory of the codebase.

Screenshot 2022-04-04 at 4 05 23 PM

If you want to change the path for .wwebjs_auth folder then you can specify a dataPath option Eg: LocalAuth({ dataPath: '/home/whatsappSession' })

Ref: https://wwebjs.dev/guide/authentication.html#localauth-strategy