whatsapp-http-api
whatsapp-http-api copied to clipboard
Weird error caused a running session to stop
engine :web.js version :core steps to replicate : unknown , it just happened 10 hours after starting the session
error
{
"statusCode": 500,
"timestamp": "2023-01-15T17:46:27.248Z",
"exception": {
"stack": "Error: Protocol error: Connection closed. Most likely the page has been closed.\n at assert (/app/node_modules/whatsapp-web.js/node_modules/puppeteer/lib/cjs/puppeteer/common/assert.js:26:15)\n at Page.close (/app/node_modules/whatsapp-web.js/node_modules/puppeteer/lib/cjs/puppeteer/common/Page.js:2126:32)\n at WhatsappSessionWebJSCore.stop (/app/dist/core/session.webjs.core.js:39:38)\n at SessionManagerCore.stop (/app/dist/core/manager.core.js:92:23)\n at SessionsController.stop (/app/dist/api/sessions.controller.js:29:29)\n at /app/node_modules/@nestjs/core/router/router-execution-context.js:38:29\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n at async /app/node_modules/@nestjs/core/router/router-execution-context.js:46:28\n at async /app/node_modules/@nestjs/core/router/router-proxy.js:9:17",
"message": "Protocol error: Connection closed. Most likely the page has been closed.",
"name": "Error"
},
"request": {
"path": "/api/sessions/stop",
"method": "POST",
"body": {
"name": "default"
},
"query": {}
},
"version": {
"version": "2022.12.11",
"tier": "CORE"
}
}
in this case I am sending a request to STOP endpoint, but it's the same for all other endpoints
hi, it just happened again
{
"statusCode": 500,
"timestamp": "2023-01-16T16:38:53.402Z",
"exception": {
"stack": "Error: Protocol error (Target.activateTarget): Session closed. Most likely the page has been closed.\n at CDPSession.send (/app/node_modules/whatsapp-web.js/node_modules/puppeteer/lib/cjs/puppeteer/common/Connection.js:218:35)\n at Page._screenshotTask (/app/node_modules/whatsapp-web.js/node_modules/puppeteer/lib/cjs/puppeteer/common/Page.js:1984:28)\n at /app/node_modules/whatsapp-web.js/node_modules/puppeteer/lib/cjs/puppeteer/common/Page.js:1981:62",
"message": "Protocol error (Target.activateTarget): Session closed. Most likely the page has been closed.",
"name": "Error"
},
"request": {
"path": "/api/screenshot?session=default",
"method": "GET",
"body": {},
"query": {
"session": "default"
}
},
"version": {
"version": "2022.12.11",
"tier": "CORE"
}
it that like some sort of timeout ?
https://github.com/pedroslopez/whatsapp-web.js/issues/1387 that might help
it that like some sort of timeout ?
I don't think so. Just browser had been closed before the request.
Weird, I'll test it and look how we can fix it
hi , it happened again
{ "statusCode": 500, "timestamp": "2023-01-19T10:36:26.176Z", "exception": { "stack": "Error: Protocol error: Connection closed. Most likely the page has been closed.\n at assert (/app/node_modules/whatsapp-web.js/node_modules/puppeteer/lib/cjs/puppeteer/common/assert.js:26:15)\n at Page.close (/app/node_modules/whatsapp-web.js/node_modules/puppeteer/lib/cjs/puppeteer/common/Page.js:2126:32)\n at WhatsappSessionWebJSCore.stop (/app/dist/core/session.webjs.core.js:39:38)\n at SessionManagerCore.stop (/app/dist/core/manager.core.js:92:23)\n at SessionsController.stop (/app/dist/api/sessions.controller.js:29:29)\n at /app/node_modules/@nestjs/core/router/router-execution-context.js:38:29\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n at async /app/node_modules/@nestjs/core/router/router-execution-context.js:46:28\n at async /app/node_modules/@nestjs/core/router/router-proxy.js:9:17", "message": "Protocol error: Connection closed. Most likely the page has been closed.", "name": "Error" }, "request": { "path": "/api/sessions/stop", "method": "POST", "body": { "name": "default" }, "query": {} }, "version": { "version": "2022.12.11", "tier": "CORE" } }
@behind24proxies does it happens in other endpoints or only in /stop
?
@behind24proxies does it happens in other endpoints or only in
/stop
?
On all of them
@allburov I'm having the same problem, after a few hours of starting the session it gives this error.
I leave you with some questions:
Can the session close due to no interaction for some period of time? If the webhook goes off, what is the behavior of the session?
{ "statusCode": 500, "timestamp": "2023-09-27T12:11:39.041Z", "exception": { "stack": "Error: Protocol error (Target.activateTarget): Session closed. Most likely the page has been closed.\n at CDPSession.send (/app/node_modules/whatsapp-web.js/node_modules/puppeteer/lib/cjs/puppeteer/common/Connection.js:218:35)\n at Page._screenshotTask (/app/node_modules/whatsapp-web.js/node_modules/puppeteer/lib/cjs/puppeteer/common/Page.js:1984:28)\n at /app/node_modules/whatsapp-web.js/node_modules/puppeteer/lib/cjs/puppeteer/common/Page.js:1981:62", "message": "Protocol error (Target.activateTarget): Session closed. Most likely the page has been closed.", "name": "Error" }, "request": { "path": "/api/screenshot?session=local", "method": "GET", "body": {}, "query": { "session": "local" } }, "version": { "version": "2023.9.7", "tier": "PLUS", "browser": "/usr/bin/chromium" } }
Hi! We've added session autorestart in WEBJS in case of failiing chromium, try updating and see if it helps
Can the session close due to no interaction for some period of time?
Unlikely, only if there's no memory or an error
If the webhook goes off, what is the behavior of the session?
It retries, nothing with chrome instance should be done.
@whera If it happens with the latest version - could you enable debug mode and send the logs here? https://waha.devlike.pro/docs/how-to/sessions/#enable-debug
Another option to try - to use Chrome version instead https://waha.devlike.pro/docs/how-to/engines/#docker-images
devlikeapro/waha-plus:chrome