Baileys icon indicating copy to clipboard operation
Baileys copied to clipboard

[BUG] connection closed due to Error: Stream Errored (ack)

Open muhammad-bassiouni opened this issue 2 years ago • 19 comments

The script is working fine, but suddenly it crashes producing the following error {"level":50,"time":"2022-07-07T15:00:48.661Z","pid":xxxx,"hostname":"xxxx","class":"baileys","node":{"tag":"stream:error","attrs":{},"content":[{"tag":"ack","attrs":{"id":"xxxxxxxxxxxxx"}}]},"msg":"stream errored out"} {"level":30,"time":"2022-07-07T15:00:48.664Z","pid":xxxx,"hostname":"xxxx","class":"baileys","error":{"data":{"tag":"stream:error","attrs":{},"content":[{"tag":"ack","attrs":{"id":"xxxxxxxxxxxxx"}}]},"isBoom":true,"isServer":true,"output":{"statusCode":500,"payload":{"statusCode":500,"error":"Internal Server Error","message":"An internal server error occurred"},"headers":{}}},"trace":"Error: Stream Errored (ack)\n at WebSocket.<anonymous> (.\\src\\Socket\\socket.ts:513:7)\n at WebSocket.emit (node:events:527:28)\n at WebSocket.emit (node:domain:475:12)\n at .\baileys\\src\\Utils\\noise-handler.ts:164:5)\n at WebSocket.onMessageRecieved (.\\baileys\\src\\Socket\\socket.ts:245:9)\n at WebSocket.emit (node:events:527:28)\n at WebSocket.emit (node:domain:475:12)\n at Receiver.receiverOnMessage (.\\baileys\\node_modules\\ws\\lib\\websocket.js:1169:20)\n at Receiver.emit (node:events:527:28)","msg":"connection errored"} connection closed due to Error: Stream Errored (ack) at WebSocket.<anonymous> (.\baileys\src\Socket\socket.ts:513:7) at WebSocket.emit (node:events:527:28) at WebSocket.emit (node:domain:475:12) at .\baileys\src\Socket\socket.ts:273:23 at Object.decodeFrame (.\baileys\src\Utils\noise-handler.ts:164:5) at WebSocket.onMessageRecieved (.\baileys\src\Socket\socket.ts:245:9) at WebSocket.emit (node:events:527:28) at WebSocket.emit (node:domain:475:12) at Receiver.receiverOnMessage (.\baileys\node_modules\ws\lib\websocket.js:1169:20) at Receiver.emit (node:events:527:28) { data: { tag: 'stream:error', attrs: {}, content: [ [Object] ] }, isBoom: true, isServer: true, output: { statusCode: 500, payload: { statusCode: 500, error: 'Internal Server Error', message: 'An internal server error occurred' }, headers: {} } } , reconnecting true

muhammad-bassiouni avatar Jul 07 '22 15:07 muhammad-bassiouni

I'm having the same problem

cassiano-guardianserver avatar Jul 14 '22 20:07 cassiano-guardianserver

I'm having the same problem

mrhb6006 avatar Jul 17 '22 13:07 mrhb6006

I'm having the same problem

tiagoagenor avatar Jul 17 '22 20:07 tiagoagenor

the same here

Guilherme-j10 avatar Jul 19 '22 13:07 Guilherme-j10

someone solved it ?

Guilherme-j10 avatar Jul 19 '22 13:07 Guilherme-j10

I also experienced this, already using the latest version

makanSukros avatar Jul 21 '22 14:07 makanSukros

I'm having the same problem

luispimenta avatar Jul 21 '22 21:07 luispimenta

i'm experiencing this too i hope someone do maintenance for this, kinda disappointing to see all the issues on this problem goes stale without a real solution

omarmyousef avatar Jul 23 '22 10:07 omarmyousef

i'm experiencing this too i hope someone do maintenance for this, kinda disappointing to see all the issues on this problem goes stale without a real solution

+1

makanSukros avatar Jul 26 '22 11:07 makanSukros

Up.. I'm using the latest version 4.3.0

m4nzm333 avatar Jul 26 '22 17:07 m4nzm333

Still relevant

neves-gabriel avatar Jul 27 '22 03:07 neves-gabriel

This issue is stale because it has been open 6 days with no activity. Remove the stale label or comment or this will be closed in 2 days

github-actions[bot] avatar Aug 02 '22 03:08 github-actions[bot]

Still relevant

neves-gabriel avatar Aug 02 '22 14:08 neves-gabriel

Still relevant, same issue

artmerlop avatar Aug 02 '22 20:08 artmerlop

I'm having the same problem

@luispimenta did you solved it?

artmerlop avatar Aug 02 '22 20:08 artmerlop

I'm having the same problem

@luispimenta did you solved it?

@artmerlop no :(

luispimenta avatar Aug 02 '22 20:08 luispimenta

Same Error Here

h4775346 avatar Aug 06 '22 08:08 h4775346

+1

ni3mumbaikar avatar Aug 06 '22 19:08 ni3mumbaikar

solved added

sock.ev.on("creds.update", saveCreds);

ni3mumbaikar avatar Aug 06 '22 19:08 ni3mumbaikar

Where will I add the line?

Samcotech-ng avatar Aug 12 '22 07:08 Samcotech-ng

Where will I add the line?

This is my connection code snippet

async function connectToWhatsApp() {

  const { state, saveCreds } = await useMultiFileAuthState("auth_info_baileys");

  const sock = makeWASocket({
    printQRInTerminal: true,
    auth: state,
    logger: P({ level: "silent" }),
  });

  sock.ev.on("creds.update", saveCreds);

  sock.ev.on("connection.update", async (update) => {

    const { connection, lastDisconnect } = update;
    if (connection === "close") {

      let shouldReconnect = lastDisconnect.error.output.statusCode !== DisconnectReason.loggedOut;
      console.log("connection closed due to ", lastDisconnect.error, ", reconnecting ", shouldReconnect);

      if (shouldReconnect) {
        shouldReconnect = false;
        await connectToWhatsApp();
      }
    }

  });

ni3mumbaikar avatar Aug 14 '22 15:08 ni3mumbaikar

Where will I add the line?

This is my connection code snippet

async function connectToWhatsApp() {

  const { state, saveCreds } = await useMultiFileAuthState("auth_info_baileys");

  const sock = makeWASocket({
    printQRInTerminal: true,
    auth: state,
    logger: P({ level: "silent" }),
  });

  sock.ev.on("creds.update", saveCreds);

  sock.ev.on("connection.update", async (update) => {

    const { connection, lastDisconnect } = update;
    if (connection === "close") {

      let shouldReconnect = lastDisconnect.error.output.statusCode !== DisconnectReason.loggedOut;
      console.log("connection closed due to ", lastDisconnect.error, ", reconnecting ", shouldReconnect);

      if (shouldReconnect) {
        shouldReconnect = false;
        await connectToWhatsApp();
      }
    }

  });

Which file will I put this.

Sorry, I'm a beginner.

The session doesn't end (It shows active when I check on my phone) but the chatbot stop responding

Samcotech-ng avatar Aug 14 '22 15:08 Samcotech-ng

@Samcotech-ng I am not sure which file exactly in your case but it has to be in the same file where you are creating socket.

ni3mumbaikar avatar Aug 14 '22 15:08 ni3mumbaikar

@Samcotech-ng I am not sure which file exactly in your case but it has to be in the same file where you are creating socket.

Okay Thanks

I'll try it Is my issue related to yours?

It just stop replying messages even though it's still connected It doesn't happen on all whatsapps.

Samcotech-ng avatar Aug 14 '22 15:08 Samcotech-ng

@Samcotech-ng I am not sure which file exactly in your case but it has to be in the same file where you are creating socket.

Sorry, I can't find the file. I checked socket.js

Samcotech-ng avatar Aug 14 '22 16:08 Samcotech-ng

This issue is stale because it has been open 6 days with no activity. Remove the stale label or comment or this will be closed in 2 days

github-actions[bot] avatar Aug 21 '22 03:08 github-actions[bot]