whatsapp-api
whatsapp-api copied to clipboard
Puppeteer exception killing the App
When disconnecting the session from mobile phone, the app dies with the following message:
/usr/src/app/node_modules/puppeteer/lib/cjs/puppeteer/common/Connection.js:230
error: new Errors_js_1.ProtocolError(),
^
ProtocolError: Protocol error (Network.getResponseBody): Target closed.
at /usr/src/app/node_modules/puppeteer/lib/cjs/puppeteer/common/Connection.js:230:24
at new Promise (<anonymous>)
at CDPSession.send (/usr/src/app/node_modules/puppeteer/lib/cjs/puppeteer/common/Connection.js:226:16)
at /usr/src/app/node_modules/puppeteer/lib/cjs/puppeteer/common/HTTPResponse.js:128:57
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async HTTPResponse.text (/usr/src/app/node_modules/puppeteer/lib/cjs/puppeteer/common/HTTPResponse.js:148:25)
at async /usr/src/app/node_modules/whatsapp-web.js/src/Client.js:757:44 {
originalMessage: ''
}
This happened using the container and also when running through npm start.
Its a random issue. Sometimes it disconnects normal and once in a while it just crashes.
Thanks for the help and good luck fixing it.
Cheers.
@raffus a temporary solution is to set the RECOVER_SESSIONS env to false. Need more time to find why the exception is not handled in some cases.
Hi there @avoylenko, thanks for the reply. The problem persists:
Failed to send new message webhook: rafael disconnected Request failed with status code 404 { reason: 'NAVIGATION' }
/usr/src/app/node_modules/puppeteer/lib/cjs/puppeteer/common/Connection.js:230
error: new Errors_js_1.ProtocolError(),
^
ProtocolError: Protocol error (Network.getResponseBody): Target closed.
at /usr/src/app/node_modules/puppeteer/lib/cjs/puppeteer/common/Connection.js:230:24
at new Promise (<anonymous>)
at CDPSession.send (/usr/src/app/node_modules/puppeteer/lib/cjs/puppeteer/common/Connection.js:226:16)
at /usr/src/app/node_modules/puppeteer/lib/cjs/puppeteer/common/HTTPResponse.js:128:57
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async HTTPResponse.text (/usr/src/app/node_modules/puppeteer/lib/cjs/puppeteer/common/HTTPResponse.js:148:25)
at async /usr/src/app/node_modules/whatsapp-web.js/src/Client.js:757:44 {
originalMessage: ''
}
Node.js v20.11.1
npm notice
npm notice New minor version of npm available! 10.2.4 -> 10.5.0
npm notice Changelog: https://github.com/npm/cli/releases/tag/v10.5.0
npm notice Run npm install -g [email protected] to update!
npm notice
Also, is there anyway to avoid the API from retrieving old messages? HUGE Thanks.