WhiskeySockets / Baileys

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

Phone Number loggout instantly after scanning #779

Closed rahulmehra1496 closed 1 month ago

rahulmehra1496 commented 1 month ago

Phone Number loggout instantly after scanning getting below error:-

Connection closed. You are logged out. 3|WaunofficialNode3007 | updateInstanceStatus 339 | Changing instance status to :: false 3|WaunofficialNode3007 | startsock :: connection update { 3|WaunofficialNode3007 | connection: 'close', 3|WaunofficialNode3007 | lastDisconnect: { 3|WaunofficialNode3007 | error: Error: Stream Errored (conflict) 3|WaunofficialNode3007 | at WebSocket. (/opt/NodeJs/WAMultiDevice3007/whatsappmultipledevice/Baileys-master/src/Socket/socket.ts:514:7) 3|WaunofficialNode3007 | at WebSocket.emit (events.js:400:28) 3|WaunofficialNode3007 | at WebSocket.emit (domain.js:475:12) 3|WaunofficialNode3007 | at /opt/NodeJs/WAMultiDevice3007/whatsappmultipledevice/Baileys-master/src/Socket/socket.ts:278:23 3|WaunofficialNode3007 | at Object.decodeFrame (/opt/NodeJs/WAMultiDevice3007/whatsappmultipledevice/Baileys-master/src/Utils/noise-handler.ts:164:5)

Old connections are working but new connections are not made.

postguruji commented 1 month ago

Yes we facing the same issue

rbkayz commented 1 month ago

Same error. This is happening on Whatsapp web as well. This is what is causing the error

image

web-codder commented 1 month ago

getting same issue

sairmali commented 1 month ago

1+

manojsitapara commented 1 month ago

After updating whatsapp app to latest version, it works for me, I was facing same issue in the morning

postguruji commented 1 month ago

can you provide me ver because we tested v-2.24.9.80 with the same issue

web-codder commented 1 month ago

v-2.24.9.80 yes its latest with same issue

sairmali commented 1 month ago

https://whatsapp-messenger.en.uptodown.com/android/download/113660134

whatsapp all vision list

web-codder commented 1 month ago

update to 2.24.10.21 but still not working in whatsapp business

Riders004 commented 1 month ago

After updating whatsapp app to latest version, it works for me, I was facing same issue in the morning

Nah it's not working

Riders004 commented 1 month ago

After updating whatsapp app to latest version, it works for me, I was facing same issue in the morning

Screenshot_2024-05-11-16-20-55-31_74594bd74a0419242537a8d02ba17993.jpg

This version works for me with the latest version of the library

I'm beta user

rahulmehra1496 commented 1 month ago

not working

himanshuja commented 1 month ago

Experiencing the same issue. All existing accounts are getting log out.

bentacos commented 1 month ago

this seems to be happening for india users only

Riders004 commented 1 month ago

this seems to be happening for india users only

Yes inky for Indian number

Riders004 commented 1 month ago

Experiencing the same issue. All existing accounts are getting log out.

Existing account can't get logout but new connection didn't link

Riders004 commented 1 month ago

@PurpShell @SheIITear

web-codder commented 1 month ago

this error only happens with Indian mobile number I test same code same version from other country mobile number then its working fine

Riders004 commented 1 month ago

this error only happens with Indian mobile number I test same code same version from other country mobile number then its working fine

Due to WhatsApp Indian user in heavy numbers

web-codder commented 1 month ago

this error only happens with Indian mobile number I test same code same version from other country mobile number then its working fine

Due to WhatsApp Indian user in heavy numbers

Maybe indian users are att top in spamming so................ its a gift from whatsapp for indian numbers

postguruji commented 1 month ago

Hi everyone,

I've reviewed the ongoing discussion about the logout issue after scanning. It seems this might be related to WebSocket conflicts, specifically with new connections. Has anyone tried debugging the WebSocket traffic to pinpoint when the conflict occurs, or if specific conditions exacerbate this issue? It might also help to confirm if this issue persists across different versions of Baileys and WhatsApp Web, or if it's localized to specific versions.

meetshamee commented 1 month ago

yes, Again the same issue last time fixed by @SheIITear #702

sahilbrandwala commented 1 month ago

+1

meetshamee commented 1 month ago

this error only happens with Indian mobile number I test same code same version from other country mobile number then its working fine

Due to WhatsApp Indian user in heavy numbers

Maybe indian users are att top in spamming so................ its a gift from whatsapp for indian numbers

Not only that, but WhatsApp got caught in the Indian legal tangle. So more encryption is done on Indian numbers in new updates

postguruji commented 1 month ago

I've noticed that even though Baileys previously addressed this logout issue, it seems to have resurfaced. Could this be related to recent updates either in Baileys or WhatsApp itself? It might be helpful to track changes in both applications that could have re-introduced this bug. If anyone has insights into the specific changes or commits that might be causing this, sharing that could be crucial to finding a workaround or permanent fix.

postguruji commented 1 month ago

this error only happens with Indian mobile number I test same code same version from other country mobile number then its working fine

Due to WhatsApp Indian user in heavy numbers

Maybe indian users are att top in spamming so................ its a gift from whatsapp for indian numbers

Not only that, but WhatsApp got caught in the Indian legal tangle. So more encryption is done on Indian numbers in new updates

It's interesting to note that this error seems initially isolated to Indian mobile numbers. However, I've conducted some tests using the same code and version with numbers from other countries, and there were no issues. This might suggest that the problem could eventually affect users globally as WhatsApp updates roll out further. It’s important for us to keep an eye on this and share any new findings that could help everyone better understand and possibly circumvent this issue.

meetshamee commented 1 month ago

In the last issue I facilitated @SheIITear to test the Indian number. Trying to contact him now

postguruji commented 1 month ago

Thanks for mentioning that. I recall facilitating the tests with @SheIITear on the Indian number issue. I'm trying to get in touch with him now to see if we can gather more insights or replicate the problem to understand it better. If anyone else has similar experiences or data to share, please do contribute!

meetshamee commented 1 month ago

Thanks for mentioning that. I recall facilitating the tests with @SheIITear on the Indian number issue. I'm trying to get in touch with him now to see if we can gather more insights or replicate the problem to understand it better. If anyone else has similar experiences or data to share, please do contribute!

Remember! Only problem with new QR link. The ones linked earlier are still working.

postguruji commented 1 month ago

Yes, that's correct. It appears the problem is specifically with linking new devices via the new QR code. Devices that were previously linked are still functioning normally. This distinction is crucial for troubleshooting the issue further.

rbkayz commented 1 month ago

Also, this problem seems to be isolated to cloud servers. Works perfectly fine on local machines

meetshamee commented 1 month ago

if needed to connect and test , we will give Indian numbers

postguruji commented 1 month ago

Also, this problem seems to be isolated to cloud servers. Works perfectly fine on local machines

Yes, it seems this issue is specific to cloud servers, as local machines, particularly those running Windows, are not affected and function correctly. This could be a key detail in pinpointing the source of the problem.

postguruji commented 1 month ago

if needed to connect and test , we will give Indian numbers

how I help??

rbkayz commented 1 month ago

Same error. This is happening on Whatsapp web as well. This is what is causing the error

image

I spun up a windows server on gcp, and tried to connect my phone to web WhatsApp. No code injection. This was the error

This looks like some sort of a bug in retrieving details of the user during initial connect

tuin007 commented 1 month ago

Did anyone manage to solve it?

postguruji commented 1 month ago

`const { makeWASocket, useMultiFileAuthState } = require('@whiskeysockets/baileys'); const qrcode = require('qrcode-terminal');

async function initializeWhatsApp() { const { state, saveState } = await useMultiFileAuthState('./auth_info');

const socket = makeWASocket({
    auth: state
});

socket.ev.on('connection.update', (update) => {
    console.log('Connection Update:', update);
    if (update.connection === 'close') {
        console.log('Disconnected:', update.lastDisconnect?.error);
        // Add reconnection logic if needed
    } else if (update.qr) {
        console.log('QR Code:', update.qr);
        qrcode.generate(update.qr, { small: true });
    }
});

socket.ev.on('connection.update', (update) => {
    console.log('Connection Update:', update);
});

socket.ev.on('messages.upsert', (msg) => {
    console.log('New message:', JSON.stringify(msg, null, 2));
    // Respond to messages or handle them as needed
});

}

initializeWhatsApp();

After the scanning, the device shows the below errors Connection Update: { connection: 'close', lastDisconnect: { error: Error: Stream Errored (restart required) at WebSocketClient. (E:\My Node\baileys\node_modules\@whiskeysockets\baileys\lib\Socket\socket.js:519:13) at WebSocketClient.emit (node:events:513:28) at E:\My Node\baileys\node_modules\@whiskeysockets\baileys\lib\Socket\socket.js:236:35 at Object.decodeFrame (E:\My Node\baileys\node_modules\@whiskeysockets\baileys\lib\Utils\noise-handler.js:136:17) at WebSocketClient.onMessageReceived (E:\My Node\baileys\node_modules\@whiskeysockets\baileys\lib\Socket\socket.js:212:15) at WebSocketClient.emit (node:events:513:28) at WebSocket. (E:\My Node\baileys\node_modules\@whiskeysockets\baileys\lib\Socket\Client\web-socket-client.js:46:100) at WebSocket.emit (node:events:513:28) at Receiver.receiverOnMessage (E:\My Node\baileys\node_modules\ws\lib\websocket.js:1209:20) at Receiver.emit (node:events:513:28) { data: [Object], isBoom: true, isServer: true, output: [Object] }, date: 2024-05-12T01:21:51.869Z } } Disconnected: Error: Stream Errored (restart required) at WebSocketClient. (E:\My Node\baileys\node_modules\@whiskeysockets\baileys\lib\Socket\socket.js:519:13) at WebSocketClient.emit (node:events:513:28) at E:\My Node\baileys\node_modules\@whiskeysockets\baileys\lib\Socket\socket.js:236:35 at Object.decodeFrame (E:\My Node\baileys\node_modules\@whiskeysockets\baileys\lib\Utils\noise-handler.js:136:17) at WebSocketClient.onMessageReceived (E:\My Node\baileys\node_modules\@whiskeysockets\baileys\lib\Socket\socket.js:212:15) at WebSocketClient.emit (node:events:513:28) at WebSocket. (E:\My Node\baileys\node_modules\@whiskeysockets\baileys\lib\Socket\Client\web-socket-client.js:46:100) at WebSocket.emit (node:events:513:28) at Receiver.receiverOnMessage (E:\My Node\baileys\node_modules\ws\lib\websocket.js:1209:20) at Receiver.emit (node:events:513:28) { data: { tag: 'stream:error', attrs: { code: '515' }, content: undefined }, isBoom: true, isServer: true, output: { statusCode: 515, payload: { statusCode: 515, error: 'Unknown', message: 'Stream Errored (restart required)' }, headers: {} } } Connection Update: { connection: 'close', lastDisconnect: { error: Error: Stream Errored (restart required) at WebSocketClient. (E:\My Node\baileys\node_modules\@whiskeysockets\baileys\lib\Socket\socket.js:519:13) at WebSocketClient.emit (node:events:513:28) at E:\My Node\baileys\node_modules\@whiskeysockets\baileys\lib\Socket\socket.js:236:35 at Object.decodeFrame (E:\My Node\baileys\node_modules\@whiskeysockets\baileys\lib\Utils\noise-handler.js:136:17) at WebSocketClient.onMessageReceived (E:\My Node\baileys\node_modules\@whiskeysockets\baileys\lib\Socket\socket.js:212:15) at WebSocketClient.emit (node:events:513:28) at WebSocket. (E:\My Node\baileys\node_modules\@whiskeysockets\baileys\lib\Socket\Client\web-socket-client.js:46:100) at WebSocket.emit (node:events:513:28) at Receiver.receiverOnMessage (E:\My Node\baileys\node_modules\ws\lib\websocket.js:1209:20) at Receiver.emit (node:events:513:28) { data: [Object], isBoom: true, isServer: true, output: [Object] }, date: 2024-05-12T01:21:51.869Z } }

E:\My Node\baileys> `

tuin007 commented 1 month ago

Do these changes solve the problem?

meetshamee commented 1 month ago

Still Not Fixed.

kj2222 commented 1 month ago

We are also facing the same issue. It's only some of our numbers though so not sure what's going on. But same error:

connection update { connection: 'close', lastDisconnect: { error: Error: Stream Errored (restart required) at WebSocketClient. (/Users/a/Documents/GitHub/Baileysfinal/src/Socket/socket.ts:662:7) at WebSocketClient.emit (node:events:518:28) at WebSocketClient.emit (node:domain:488:12) at /Users/a/Documents/GitHub/Baileysfinal/src/Socket/socket.ts:338:23 at Object.decodeFrame (/Users/a/Documents/GitHub/Baileysfinal/src/Utils/noise-handler.ts:176:5) at WebSocketClient.onMessageReceived (/Users/a/Documents/GitHub/Baileysfinal/src/Socket/socket.ts:310:9) at WebSocketClient.emit (node:events:518:28) at WebSocketClient.emit (node:domain:488:12) at WebSocket. (/Users/a/Documents/GitHub/Baileysfinal/src/Socket/Client/web-socket-client.ts:40:52) at WebSocket.emit (node:events:518:28) { data: [Object], isBoom: true, isServer: true, output: [Object] }, date: 2024-05-11T19:52:34.215Z } }

mycodemm commented 1 month ago

Now it's working but with old bailey version.

manojsitapara commented 1 month ago

Now it's working but with old bailey version.

which version are you using?

meetshamee commented 1 month ago

Now it's working but with old bailey version.

which version are you using?

techgod143 commented 1 month ago

Hello friends, after fix this issue i shell notify you on my youtube or whatsapp channel go and follow to Tech God

postguruji commented 1 month ago

We've successfully integrated the latest version of Baileys in a new project running on a Windows PC, and it works perfectly. However, on cloud servers, the session disconnects right after scanning. It seems WhatsApp LLC might be specifically targeting Indian (+91) numbers, which frequently use unofficial APIs. This could indicate a significant shift in the unofficial API market in India, perhaps signaling an end to its current form.

ZviCode commented 1 month ago

It also happened to me with a 972 in Israel Disconnects right after scanning, even when singing in Israel, not necessarily in the cloud

ubunto 20.04 Baylis updated version 6.7.2

Riders004 commented 1 month ago

It's happens only on cloud server but local machine it's working perfectly

magicgodsir commented 1 month ago

Plze solve this problem auto logout on WhatsApp

web-codder commented 1 month ago

Yes its confirmed its working at local machine with same code and Indian number issue causing only on cloud servers maybe they are tracking any type of server requests

web-codder commented 1 month ago

connection closed due to Error: Stream Errored (conflict) at WebSocketClient. (/root/test/node_modules/@whiskeysockets/baileys/lib/Socket/socket.js:519:13) at WebSocketClient.emit (node:events:513:28) at /root/test/node_modules/@whiskeysockets/baileys/lib/Socket/socket.js:236:35 at Object.decodeFrame (/root/test/node_modules/@whiskeysockets/baileys/lib/Utils/noise-handler.js:136:17) at WebSocketClient.onMessageReceived (/root/test/node_modules/@whiskeysockets/baileys/lib/Socket/socket.js:212:15) at WebSocketClient.emit (node:events:513:28) at WebSocket. (/root/test/node_modules/@whiskeysockets/baileys/lib/Socket/Client/web-socket-client.js:46:100) at WebSocket.emit (node:events:513:28) at Receiver.receiverOnMessage (/root/test/node_modules/ws/lib/websocket.js:1209:20) at Receiver.emit (node:events:513:28) { data: { tag: 'stream:error', attrs: { code: '401' }, content: [ [Object] ] }, isBoom: true, isServer: false, output: { statusCode: 401, payload: { statusCode: 401, error: 'Unauthorized', message: 'Stream Errored (conflict)' }, headers: {} } } , reconnecting true {"level":30,"time":"2024-05-12T17:21:23.512Z","pid":15556,"hostname":"sabhay.wappblaster.in","class":"baileys","browser":["Ubuntu","Chrome","20.0.04"],"helloMsg":{"clientHello":{"ephemeral":"wfA0tOoOhC2f+DhwDmTkGqWHfBHOaNr5yJpaRaXpCDU="}},"msg":"connected to WA"} {"level":30,"time":"2024-05-12T17:21:23.589Z","pid":15556,"hostname":"sabhay.wappblaster.in","class":"baileys","node":{"username":"918949666472","passive":true,"userAgent":{"platform":"WEB","appVersion":{"primary":2,"secondary":2403,"tertiary":2},"mcc":"000","mnc":"000","osVersion":"0.1","manufacturer":"","device":"Desktop","osBuildNumber":"0.1","releaseChannel":"RELEASE","localeLanguageIso6391":"en","localeCountryIso31661Alpha2":"US"},"webInfo":{"webSubPlatform":"WEB_BROWSER"},"connectType":"WIFI_UNKNOWN","connectReason":"USER_ACTIVATED","device":76},"msg":"logging in..."} {"level":30,"time":"2024-05-12T17:21:24.268Z","pid":15556,"hostname":"sabhay.wappblaster.in","class":"baileys","trace":"Error: Connection Failure\n at WebSocketClient. (/root/test/node_modules/@whiskeysockets/baileys/lib/Socket/socket.js:524:13)\n at WebSocketClient.emit (node:events:513:28)\n at /root/test/node_modules/@whiskeysockets/baileys/lib/Socket/socket.js:236:35\n at Object.decodeFrame (/root/test/node_modules/@whiskeysockets/baileys/lib/Utils/noise-handler.js:136:17)\n at WebSocketClient.onMessageReceived (/root/test/node_modules/@whiskeysockets/baileys/lib/Socket/socket.js:212:15)\n at WebSocketClient.emit (node:events:513:28)\n at WebSocket. (/root/test/node_modules/@whiskeysockets/baileys/lib/Socket/Client/web-socket-client.js:46:100)\n at WebSocket.emit (node:events:513:28)\n at Receiver.receiverOnMessage (/root/test/node_modules/ws/lib/websocket.js:1209:20)\n at Receiver.emit (node:events:513:28)","msg":"connection errored"} connection closed due to Error: Connection Failure at WebSocketClient. (/root/test/node_modules/@whiskeysockets/baileys/lib/Socket/socket.js:524:13) at WebSocketClient.emit (node:events:513:28) at /root/test/node_modules/@whiskeysockets/baileys/lib/Socket/socket.js:236:35 at Object.decodeFrame (/root/test/node_modules/@whiskeysockets/baileys/lib/Utils/noise-handler.js:136:17) at WebSocketClient.onMessageReceived (/root/test/node_modules/@whiskeysockets/baileys/lib/Socket/socket.js:212:15) at WebSocketClient.emit (node:events:513:28) at WebSocket. (/root/test/node_modules/@whiskeysockets/baileys/lib/Socket/Client/web-socket-client.js:46:100) at WebSocket.emit (node:events:513:28) at Receiver.receiverOnMessage (/root/test/node_modules/ws/lib/websocket.js:1209:20) at Receiver.emit (node:events:513:28) { data: { reason: '401', location: 'nao' }, isBoom: true, isServer: false, output: { statusCode: 401, payload: { statusCode: 401, error: 'Unauthorized', message: 'Connection Failure' }, headers: {} } } , reconnecting true {"level":30,"time":"2024-05-12T17:21:24.401Z","pid":15556,"hostname":"sabhay.wappblaster.in","class":"baileys","browser":["Ubuntu","Chrome","20.0.04"],"helloMsg":{"clientHello":{"ephemeral":"Nf8VAeJVkievc9RPUFm7gSoyLXcjrI8l0KltWaoVg1s="}},"msg":"connected to WA"} {"level":30,"time":"2024-05-12T17:21:24.479Z","pid":15556,"hostname":"sabhay.wappblaster.in","class":"baileys","node":{"username":"918949666472","passive":true,"userAgent":{"platform":"WEB","appVersion":{"primary":2,"secondary":2403,"tertiary":2},"mcc":"000","mnc":"000","osVersion":"0.1","manufacturer":"","device":"Desktop","osBuildNumber":"0.1","releaseChannel":"RELEASE","localeLanguageIso6391":"en","localeCountryIso31661Alpha2":"US"},"webInfo":{"webSubPlatform":"WEB_BROWSER"},"connectType":"WIFI_UNKNOWN","connectReason":"USER_ACTIVATED","device":76},"msg":"logging in..."} {"level":30,"time":"2024-05-12T17:21:29.383Z","pid":15556,"hostname":"sabhay.wappblaster.in","class":"baileys","trace":"Error: Connection Failure\n at WebSocketClient. (/root/test/node_modules/@whiskeysockets/baileys/lib/Socket/socket.js:524:13)\n at WebSocketClient.emit (node:events:513:28)\n at /root/test/node_modules/@whiskeysockets/baileys/lib/Socket/socket.js:236:35\n at Object.decodeFrame (/root/test/node_modules/@whiskeysockets/baileys/lib/Utils/noise-handler.js:136:17)\n at WebSocketClient.onMessageReceived (/root/test/node_modules/@whiskeysockets/baileys/lib/Socket/socket.js:212:15)\n at WebSocketClient.emit (node:events:513:28)\n at WebSocket. (/root/test/node_modules/@whiskeysockets/baileys/lib/Socket/Client/web-socket-client.js:46:100)\n at WebSocket.emit (node:events:513:28)\n at Receiver.receiverOnMessage (/root/test/node_modules/ws/lib/websocket.js:1209:20)\n at Receiver.emit (node:events:513:28)","msg":"connection errored"} connection closed due to Error: Connection Failure at WebSocketClient. (/root/test/node_modules/@whiskeysockets/baileys/lib/Socket/socket.js:524:13) at WebSocketClient.emit (node:events:513:28) at /root/test/node_modules/@whiskeysockets/baileys/lib/Socket/socket.js:236:35 at Object.decodeFrame (/root/test/node_modules/@whiskeysockets/baileys/lib/Utils/noise-handler.js:136:17) at WebSocketClient.onMessageReceived (/root/test/node_modules/@whiskeysockets/baileys/lib/Socket/socket.js:212:15) at WebSocketClient.emit (node:events:513:28) at WebSocket. (/root/test/node_modules/@whiskeysockets/baileys/lib/Socket/Client/web-socket-client.js:46:100) at WebSocket.emit (node:events:513:28) at Receiver.receiverOnMessage (/root/test/node_modules/ws/lib/websocket.js:1209:20) at Receiver.emit (node:events:513:28) { data: { reason: '401', location: 'nao' }, isBoom: true, isServer: false, output: { statusCode: 401, payload: { statusCode: 401, error: 'Unauthorized', message: 'Connection Failure' }, headers: {} } } , reconnecting true not working at cloud showing unauthrised