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.05k stars 3.58k forks source link

Connection Crash After 3-5 minute authenticated, Reply List Button Doesnt Work, Send Ptt File Not Working #1427

Closed razordouble7 closed 1 year ago

razordouble7 commented 2 years ago

Is there an existing issue for this?

Describe the bug

1) after latest update Connection Crash After 3-5 minute authenticated

after 3-5 minute i have scan qr and authenticated, the connection are crash.

2) Reply List Button Doesnt Work i try to use sendMessage and reply . both are not replying after user click list . i also already set the list id.

3) Send ptt not working i try to send audio file as ptt format but not working. i already set sendAudioAsVoice: false but the file will send as audio format not in ptt format.

Expected behavior

1) normal connection 2) reply after user click list 3) send as ptt format not as audio format.

Steps to Reproduce the Bug or Issue

sendAudioAsVoice: false

Relevant Code

No response

Browser Type

Chromium

WhatsApp Account Type

Standard

Does your WhatsApp account have multidevice enabled?

No, I am not using Multi Device

Environment

Ubuntu 18 Android whatsapp-web.js@latest Node.js Version 14

Additional context

No response

shmuliko commented 2 years ago

for me too crashing after few minutes and can't restore i change for multi, and this fixed

the buttons not working too (in multi)

Marat00016 commented 2 years ago

method afterBrowserInitialized in AuthStrategies/LegacySessionAuth.js

after localStorage.setItem('WAToken2', session.WAToken2);

add localStorage.setItem('last-wid', session.LastWid);

and in method getAuthEventPayload before WABrowserId: localStorage.WABrowserId,

add LastWid: localStorage['last-wid'],

its works for me

Seramak commented 2 years ago

method afterBrowserInitialized in AuthStrategies/LegacySessionAuth.js

after localStorage.setItem('WAToken2', session.WAToken2);

add localStorage.setItem('last-wid', session.LastWid);

and in method getAuthEventPayload before WABrowserId: localStorage.WABrowserId,

add LastWid: localStorage['last-wid'],

its works for me

Unfortunately does not help (for localauth). This error occurs after a few minutes of inactivity:

/opt/whatsappbot/node_modules/whatsapp-web.js/node_modules/puppeteer/lib/cjs/puppeteer/common/Connection.js:230
                error: new Errors_js_1.ProtocolError(),
                       ^

ProtocolError: Protocol error (Runtime.callFunctionOn): Target closed.
    at /opt/whatsappbot/node_modules/whatsapp-web.js/node_modules/puppeteer/lib/cjs/puppeteer/common/Connection.js:230:24
    at new Promise (<anonymous>)
    at CDPSession.send (/opt/whatsappbot/node_modules/whatsapp-web.js/node_modules/puppeteer/lib/cjs/puppeteer/common/Connection.js:226:16)
    at ExecutionContext._evaluateInternal (/opt/whatsappbot/node_modules/whatsapp-web.js/node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:204:50)
    at ExecutionContext.evaluate (/opt/whatsappbot/node_modules/whatsapp-web.js/node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:110:27)
    at DOMWorld.evaluate (/opt/whatsappbot/node_modules/whatsapp-web.js/node_modules/puppeteer/lib/cjs/puppeteer/common/DOMWorld.js:95:24)
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  originalMessage: undefined
}

Yes. It was fixed by the npm update :) RESOLVED