WhiskeySockets / Baileys

Lightweight full-featured typescript/javascript WhatsApp Web API
https://baileys.whiskeysockets.io/
MIT License
4.09k stars 1.38k forks source link

[BUG] Failure to Connect After Scanning QR Code #702

Closed AbhishekSuresh2 closed 7 months ago

AbhishekSuresh2 commented 8 months ago

Bug: I M using this WhiskeySockets library for a long time without encountering this error, but it occurred unexpectedly today.

Sample Code Of Qr:

import makeWASocket, { DisconnectReason, BufferJSON, useMultiFileAuthState } from '@whiskeysockets/baileys'
import { Boom } from '@hapi/boom'

async function connectToWhatsApp () {
    const { state, saveCreds } = await useMultiFileAuthState('auth_info_baileys')

    const sock = makeWASocket({
        auth: state,
        printQRInTerminal: true, 
    });

    sock.ev.on('creds.update', saveCreds)

    sock.ev.on('connection.update', (update) => {
        const { connection, lastDisconnect } = update
        if (connection === 'close') {
            const shouldReconnect = (lastDisconnect?.error as Boom)?.output?.statusCode !== DisconnectReason.loggedOut
            console.log('Connection closed due to', lastDisconnect?.error, ', reconnecting', shouldReconnect)
            if (shouldReconnect) {
                connectToWhatsApp() // Reconnect if necessary
            }
        } else if (connection === 'open') {
            console.log('Opened connection')
        }
    });

    sock.ev.on('messages.upsert', m => {
        console.log("Message Received: " + m.messages[0].key.remoteJid);
    });

}

connectToWhatsApp()

To Reproduce:

  1. Create a new connection.
  2. Scan the QR code.
  3. Observe the connection failure.

Expected Behavior: After scanning the QR code, the connection should be established successfully, allowing communication with WhatsApp.

Environment:

Additional Context:

Selfgamer commented 8 months ago

Yes I'm also facing the same problem

S-U-P-E-R-I-O-R commented 8 months ago

Yes we all are facing this issue

mayankagar360 commented 8 months ago

I am also facing these

mayankagar360 commented 8 months ago

In my one server their is issue and in another it is working perfect

jisan2211 commented 8 months ago

Please open this server

jisan2211 commented 8 months ago

Koi bhi bot wp link device nahi ho Raha hai

Automatic logout ho Raha hai

Please solve this problem

jisan2211 commented 8 months ago

Please solve

Loki-Xer commented 8 months ago

Yaa am also faceing this issue in new connection...!!

INR-L commented 8 months ago

Yah bro i fix inrl ban issue today but, this issue ☕

ysterymy commented 8 months ago

Please fix the problem

AnshMusicBot commented 8 months ago

QR Code Scanning Ends in WhatsApp Disconnection

mayankagar360 commented 8 months ago

QR Code Scanning Ends in WhatsApp Disconnection

have you solved the problem?

bilalking99 commented 8 months ago

Yes I'm also facing the same problem

Saswatamon commented 8 months ago

WhatsApp Linking Error: Sudden Exit After QR Code Scan

techgod143 commented 8 months ago

Hello team, my full support to you

techgod143 commented 8 months ago

we all waiting

techgod143 commented 8 months ago

hello everyone bot supporters

Pull33 commented 8 months ago

When i try to scan it exited from the link device it just vibrated i think i linked successfully but not it not showed anything just exited

Lokixgod75 commented 8 months ago

Yes when i scan i got this error

NotxAhmii commented 8 months ago

I'm facing the same issue

salmanytofficial commented 8 months ago

I am also facing this issue

aarvee022 commented 8 months ago

Same issue.

Piyasa004 commented 8 months ago

I'm facing the same issue

mayankagar360 commented 8 months ago

Any one please update the solution if we have found something

postguruji commented 8 months ago

Same issue.

Akash-Rathore commented 8 months ago

same issue

mayankagar360 commented 8 months ago

any update

hamidsaifi77 commented 8 months ago

After noticing several people reporting issues with their devices not connecting or getting disconnected, I experienced the same problem. However, after updating the WhatsApp mobile app and increasing the resources of my server, the issue was resolved for me. While it's possible that you may be facing a different problem, I suggest trying these steps if you haven't already, as they provided a solution for me.

Thanks

SheIITear commented 7 months ago

Tested yesterday logging in multiple times on both ios and android (normal & business) with no issue. Region related / specific host platform or just outdated software as mentioned on here?

dhirennjaypal commented 7 months ago

Tested yesterday logging in multiple times on both ios and android (normal & business) with no issue. Region related / specific host platform or just outdated software as mentioned on here?

Updated app and server is already High End, Windows Server with 16GB RAM, using latest version from main git branch, still it doesn't work. It used to work in past in same server.

aarvee022 commented 7 months ago

Tested yesterday logging in multiple times on both ios and android (normal & business) with no issue. Region related / specific host platform or just outdated software as mentioned on here?

i have updated the version and also updated whatsapp app. not working for me. it was working fine 2 days ago.

dhirennjaypal commented 7 months ago
Processor:  AMD EPYC-Rome Processor   2.35 GHz  (8 processors)
Installed RAM:  16.0 GB
System type:    64-bit operating system, x64-based processor

Edition:    Windows Server 2022 Standard
Version:    21H2
OS build:   20348.2340

it doesn't work in my server. above is my server specification.

souravkl11 commented 7 months ago

I think only Indian numbers/accounts are facing this issue rn. Tested on other regions, no issues! Seems strange :/

aarvee022 commented 7 months ago

I think only Indian numbers/accounts are facing this issue rn. Tested on other regions, no issues! Seems strange :/

Yes true, just tested it after your message. Indian numbers not working. Other country's numbers working fine.

souravkl11 commented 7 months ago

I think only Indian numbers/accounts are facing this issue rn. Tested on other regions, no issues! Seems strange :/

Yes true, just tested it after your message. Indian numbers not working. Other country's numbers working fine.

Meta has started to fight against unofficial libraries I guess. The starting may be from India as there are a major no. of Indian users. Edit: It's just my assumption, I'm not a piro!

makanSukros commented 7 months ago

Meta has started to fight against unofficial libraries I guess. The starting may be from India as there are a major no. of Indian users.

Yes, that's right, I agree with this, because I tried it in another region and it still runs smoothly as it should

Riders004 commented 7 months ago

Tested yesterday logging in multiple times on both ios and android (normal & business) with no issue. Region related / specific host platform or just outdated software as mentioned on here?

In messenger beta ?

ghost commented 7 months ago

yah! i tested on my accs its working but in other country like +91,+254 having this error, looks what dumb me thinking my scanner got outdated 🤣

SheIITear commented 7 months ago

I think only Indian numbers/accounts are facing this issue rn. Tested on other regions, no issues! Seems strange :/

Yes true, just tested it after your message. Indian numbers not working. Other country's numbers working fine.

I do not have access to an Indian number at the moment so I cannot test myself. I asked around from few people and they did not have any problems with Indian numbers? Have you tested another host and are you using official wa on device that is not unlocked etc?

bentacos commented 7 months ago

according to one of my users, it worked again after clearing the data of the WhatsApp app. im not able to confirm it tho.

salmanytofficial commented 7 months ago

yah! i tested on my accs its working but in other country like +91,+254 having this error, looks what dumb me thinking my scanner got outdated 🤣

It's Also Working For Me feeling Sad For +91

hamidsaifi77 commented 7 months ago

Tested yesterday logging in multiple times on both ios and android (normal & business) with no issue. Region related / specific host platform or just outdated software as mentioned on here?

Hey, after testing with multiple devices i found that the issue seems with the ip address when anyone uses Indian number with a new ip it works fine. As you mentioned that you dont have Indian number access i can help you to have one to test it and solve the problem for the world. I had one more question i used the proxy url in order to connect baileys however i was not getting the connection done using proxy i wonder why.

dhirennjaypal commented 7 months ago

I think only Indian numbers/accounts are facing this issue rn. Tested on other regions, no issues! Seems strange :/

Yes true, just tested it after your message. Indian numbers not working. Other country's numbers working fine.

I do not have access to an Indian number at the moment so I cannot test myself. I asked around from few people and they did not have any problems with Indian numbers? Have you tested another host and are you using official wa on device that is not unlocked etc?

It works in other PC, also it works in browser from that PC too. Only baileys doesn't work. Tried official android Whatsapp normal beta and iphone whatsapp business.

dsusoftech commented 7 months ago

I see this issue only in baileys library other library working 100% perfectly i tested on 3 other scripts not using baileys. So no whatsapp server side filter or country restriction or planning to stop unofficial whatsapp etc. Let's wait for baileys master mind to resolve this.

hamidsaifi77 commented 7 months ago

I see this issue only in baileys library other library working 100% perfectly i tested on 3 other scripts not using baileys. So no whatsapp server side filter or country restriction or planning to stop unofficial whatsapp etc. Let's wait for baileys master mind to resolve this.

Hi, I guess there is one other reso left which is which is working fine I have used that too. Do you know any other library which is working fine and not using the puppeteer.

dsusoftech commented 7 months ago

I dont know more about which library they are using but i can provide script link so you can check

hamidsaifi77 commented 7 months ago

I dont know more about which library they are using but i can provide script link so you can check

Thank you for quick reply please mention the link. i know one other script but that uses RAM a lot like 700-800MB ram per instance. Still please mention the script link

dsusoftech commented 7 months ago

LINK REMOVED check here package.json file uses

hamidsaifi77 commented 7 months ago

https://pastebin.com/ETS58vQJ check here package.json file uses

Thank you. This is i know what it should be let me try and get back to you here. You may now remove the link :-)

arrocy commented 7 months ago

Temporary solution: downgrade to Baileys v5.0.0

Procedure to downgrade if you are using Arrocy Whatsapp Gateway:

  1. download https://registry.npmjs.org/@adiwajshing/baileys/-/baileys-5.0.0.tgz
  2. upload to Arrocy Whatsapp Gateway node server root, extract, you will get a new folder "package"
  3. rename original "Baileys" folder to "Baileys-v6.6.0" (just for back up if you want to change back)
  4. rename "package" folder to "Baileys"
  5. restart nodejs
  6. Done!