waha icon indicating copy to clipboard operation
waha copied to clipboard

[WEBJS] - session fails - Error: Attempted to use detached Frame

Open NathyG2524 opened this issue 1 year ago • 14 comments

Describe the bug

A clear and concise description of what the bug is. Feel free to remove sections that you don't feel to make the text shorter!

{
  "version": "2025.9.4",
  "engine": "WEBJS",
  "tier": "TIER"
}

Steps

To Reproduce Steps to reproduce the behavior:

  1. Start a new session
  2. it will stuck to the status to sarting
  3. After refershing the session it will change to scan_qr_code
  4. After scaning I have to refresh it to see working status
  5. Finally, after sending few message it will change the status to failed
utomate.prod.okoarescue.com/webhook/waha-qr-webhooks"}
waha-prod  | [06:11:00.236] DEBUG (WhatsappSession/42): session:default - Should not restart the client, ignoring restart request {"reqId":741,"session":"default"}
waha-prod  | [06:11:00.236] DEBUG (WhatsappSession/42): session:default - Browser is ready to be closed: true {"reqId":741,"session":"default"}
waha-prod  | [06:11:00.242] DEBUG (WhatsappSession/42): session:default - Successfully waited for browser to be ready for closing {"reqId":741,"session":"default"}
waha-prod  | [06:11:00.242] DEBUG (WhatsappSession/42): session:default - Successfully destroyed whatsapp client {"reqId":741,"session":"default"}
waha-prod  | [06:11:00.242] DEBUG (WhatsappSession/42): session:default - Successfully destroyed auth strategy {"reqId":741,"session":"default"}
waha-prod  | [06:11:00.245] DEBUG (WhatsappSession/42): session:default - Successfully destroyed whatsapp client {"reqId":741,"session":"default"}
waha-prod  | [06:11:00.250] DEBUG (WhatsappSession/42): session:default - Successfully destroyed auth strategy {"reqId":741,"session":"default"}
waha-prod  | [06:11:00.555] INFO (WebhookSender/42): session:default - POST request was sent with status code: 200 {"reqId":741,"session":"default","id":"01K5G9HWGBX1RQHBS5VWWCQA1T","event.id":"evt_01k5g9hwg91ncc7nbaq9e9pqzq","url":"https://automate.prod.okoarescue.com/webhook/waha-qr-webhooks"}
waha-prod  | [06:11:00.555] DEBUG (WebhookSender/42): session:default - Response {"reqId":741,"session":"default","id":"01K5G9HWGBX1RQHBS5VWWCQA1T","event.id":"evt_01k5g9hwg91ncc7nbaq9e9pqzq","url":"https://automate.prod.okoarescue.com/webhook/waha-qr-webhooks","body":{"message":"Workflow was started"}}
waha-prod  | [06:11:00.586] INFO (WebhookSender/42): session:default - POST request was sent with status code: 200 {"reqId":741,"session":"default","id":"01K5G9HWFSET55VAYTVMY765A6","event.id":"evt_01k5g9hwfs1nrw9ged43s3zymy","url":"https://automate.prod.okoarescue.com/webhook/waha-qr-webhooks"}
waha-prod  | [06:11:00.586] DEBUG (WebhookSender/42): session:default - Response {"reqId":741,"session":"default","id":"01K5G9HWFSET55VAYTVMY765A6","event.id":"evt_01k5g9hwfs1nrw9ged43s3zymy","url":"https://automate.prod.okoarescue.com/webhook/waha-qr-webhooks","body":{"message":"Workflow was started"}}
waha-prod  | [06:11:00.333] ERROR (Bootstrap/42): Unhandled Rejection at:
waha-prod  | [06:11:00.333] ERROR (Bootstrap/42): Error: Attempted to use detached Frame '0B9D4DFEAFC871CD30EFC355AF79BBAC'.
waha-prod  |     at CdpFrame.<anonymous> (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/util/decorators.js:107:23)
waha-prod  |     at CdpPage.waitForFunction (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/api/Page.js:1443:37)
waha-prod  |     at WPage.waitForFunction (/app/dist/core/engines/webjs/WPage.js:43:36)
waha-prod  |     at WebjsClientCore.inject (/app/node_modules/whatsapp-web.js/src/Client.js:96:28)
waha-prod  |     at /app/node_modules/whatsapp-web.js/src/Client.js:339:24
waha-prod  | [06:11:00.645] INFO (WebhookSender/42): session:default - POST request was sent with status code: 200 {"reqId":741,"session":"default","id":"01K5G9HWG9CAQ7748YE0W3XBBJ","event.id":"evt_01k5g9hwg91ncc7nbaq9e9pqzq","url":"https://httpbin.org/post"}
waha-prod  | [06:11:00.645] DEBUG (WebhookSender/42): session:default - Response {"reqId":741,"session":"default","id":"01K5G9HWG9CAQ7748YE0W3XBBJ","event.id":"evt_01k5g9hwg91ncc7nbaq9e9pqzq","url":"https://httpbin.org/post","body":{"args":{},"data":"{\"id\":\"evt_01k5g9hwg91ncc7nbaq9e9pqzq\",\"timestamp\":1758262260233,\"event\":\"session.status\",\"session\":\"default\",\"metadata\":{},\"me\":{\"id\":\"[email protected]\",\"pushName\":\"Okoa Rescue\"},\"payload\":{\"name\":\"default\",\"status\":\"FAILED\",\"statuses\":[{\"status\":\"WORKING\",\"timestamp\":1758262097611},{\"status\":\"FAILED\",\"timestamp\":1758262260217},{\"status\":\"FAILED\",\"timestamp\":1758262260231}]},\"engine\":\"WEBJS\",\"environment\":{\"version\":\"2025.9.4\",\"engine\":\"WEBJS\",\"tier\":\"CORE\",\"browser\":\"/usr/bin/chromium\"}}","files":{},"form":{},"headers":{"Accept":"application/json, text/plain, */*","Accept-Encoding":"gzip, compress, deflate, br","Content-Length":"495","Content-Type":"application/json","Host":"httpbin.org","User-Agent":"WAHA/2025.9.4","X-Amzn-Trace-Id":"Root=1-68ccf3f4-572e30572d32f6b47ec3ba56","X-Webhook-Request-Id":"01K5G9HWG9CAQ7748YE0W3XBBJ","X-Webhook-Timestamp":"1758262260233"},"json":{"engine":"WEBJS","environment":{"browser":"/usr/bin/chromium","engine":"WEBJS","tier":"CORE","version":"2025.9.4"},"event":"session.status","id":"evt_01k5g9hwg91ncc7nbaq9e9pqzq","me":{"id":"[email protected]","pushName":"Okoa Rescue"},"metadata":{},"payload":{"name":"default","status":"FAILED","statuses":[{"status":"WORKING","timestamp":1758262097611},{"status":"FAILED","timestamp":1758262260217},{"status":"FAILED","timestamp":1758262260231}]},"session":"default","timestamp":1758262260233},"origin":"145.223.116.147","url":"https://httpbin.org/post"}}
waha-prod  | [06:11:00.954] INFO (WebhookSender/42): session:default - POST request was sent with status code: 200 {"reqId":741,"session":"default","id":"01K5G9HWFS46X8ZKS6X3PGXB89","event.id":"evt_01k5g9hwfs1nrw9ged43s3zymy","url":"https://httpbin.org/post"}
waha-prod  | [06:11:00.954] DEBUG (WebhookSender/42): session:default - Response {"reqId":741,"session":"default","id":"01K5G9HWFS46X8ZKS6X3PGXB89","event.id":"evt_01k5g9hwfs1nrw9ged43s3zymy","url":"https://httpbin.org/post","body":{"args":{},"data":"{\"id\":\"evt_01k5g9hwfs1nrw9ged43s3zymy\",\"timestamp\":1758262260217,\"event\":\"session.status\",\"session\":\"default\",\"metadata\":{},\"me\":{\"id\":\"[email protected]\",\"pushName\":\"Okoa Rescue\"},\"payload\":{\"name\":\"default\",\"status\":\"FAILED\",\"statuses\":[{\"status\":\"STARTING\",\"timestamp\":1758262092512},{\"status\":\"WORKING\",\"timestamp\":1758262097611},{\"status\":\"FAILED\",\"timestamp\":1758262260217}]},\"engine\":\"WEBJS\",\"environment\":{\"version\":\"2025.9.4\",\"engine\":\"WEBJS\",\"tier\":\"CORE\",\"browser\":\"/usr/bin/chromium\"}}","files":{},"form":{},"headers":{"Accept":"application/json, text/plain, */*","Accept-Encoding":"gzip, compress, deflate, br","Content-Length":"497","Content-Type":"application/json","Host":"httpbin.org","User-Agent":"WAHA/2025.9.4","X-Amzn-Trace-Id":"Root=1-68ccf3f4-0567c24d624f8cc674db19dc","X-Webhook-Request-Id":"01K5G9HWFS46X8ZKS6X3PGXB89","X-Webhook-Timestamp":"1758262260217"},"json":{"engine":"WEBJS","environment":{"browser":"/usr/bin/chromium","engine":"WEBJS","tier":"CORE","version":"2025.9.4"},"event":"session.status","id":"evt_01k5g9hwfs1nrw9ged43s3zymy","me":{"id":"[email protected]","pushName":"Okoa Rescue"},"metadata":{},"payload":{"name":"default","status":"FAILED","statuses":[{"status":"STARTING","timestamp":1758262092512},{"status":"WORKING","timestamp":1758262097611},{"status":"FAILED","timestamp":1758262260217}]},"session":"default","timestamp":1758262260217},"origin":"145.223.116.147","url":"https://httpbin.org/post"}}
waha-prod  | [06:11:20.249] INFO (42): request errored {"reqId":1251,"req":{"id":1251,"method":"POST","url":"/api/sendText","query":{},"params":{"path":["api","sendText"]}},"res":{"statusCode":422},"responseTime":10013}
waha-prod  |     err: {
waha-prod  |       "type": "UnprocessableEntityException",
waha-prod  |       "message": "Unprocessable Entity Exception",
waha-prod  |       "stack":
waha-prod  |           UnprocessableEntityException: Unprocessable Entity Exception
waha-prod  |               at SessionManagerCore.waitUntilStatus (/app/dist/core/abc/manager.abc.js:114:19)
waha-prod  |               at async ChattingController.sendText (/app/dist/api/chatting.controller.js:30:26)
waha-prod  |       "response": {
waha-prod  |         "error": "Session status is not as expected. Try again later or restart the session",
waha-prod  |         "session": "default",
waha-prod  |         "status": "FAILED",
waha-prod  |         "expected": [
waha-prod  |           "WORKING"
waha-prod  |         ]
waha-prod  |       },
waha-prod  |       "status": 422,
waha-prod  |       "options": {},
waha-prod  |       "name": "UnprocessableEntityException"
waha-prod  |     }
waha-prod  | [06:11:25.345] INFO (42): request errored {"reqId":1252,"req":{"id":1252,"method":"POST","url":"/api/sendText","query":{},"params":{"path":["api","sendText"]}},"res":{"statusCode":422},"responseTime":10009}
waha-prod  |     err: {
waha-prod  |       "type": "UnprocessableEntityException",
waha-prod  |       "message": "Unprocessable Entity Exception",
waha-prod  |       "stack":
waha-prod  |           UnprocessableEntityException: Unprocessable Entity Exception
waha-prod  |               at SessionManagerCore.waitUntilStatus (/app/dist/core/abc/manager.abc.js:114:19)
waha-prod  |               at async ChattingController.sendText (/app/dist/api/chatting.controller.js:30:26)
waha-prod  |       "response": {
waha-prod  |         "error": "Session status is not as expected. Try again later or restart the session",
waha-prod  |         "session": "default",
waha-prod  |         "status": "FAILED",
waha-prod  |         "expected": [
waha-prod  |           "WORKING"
waha-prod  |         ]
waha-prod  |       },
waha-prod  |       "status": 422,
waha-prod  |       "options": {},
waha-prod  |       "name": "UnprocessableEntityException"
waha-prod  |     }
waha-prod  | [06:14:20.349] INFO (42): request completed {"reqId":1429,"req":{"id":1429,"method":"GET","url":"/api/version","query":{},"params":{"path":["api","version"]}},"res":{"statusCode":304},"responseTime":1}
waha-prod  | [06:14:20.355] INFO (42): request completed {"reqId":1430,"req":{"id":1430,"method":"GET","url":"/api/sessions?all=true","query":{"all":"true"},"params":{"path":["api","sessions"]}},"res":{"statusCode":200},"responseTime":1}
waha-prod  | [06:14:20.357] INFO (42): request completed {"reqId":1431,"req":{"id":1431,"method":"GET","url":"/api/server/status","query":{},"params":{"path":["api","server","status"]}},"res":{"statusCode":200},"responseTime":1}
waha-prod  | [06:14:20.546] INFO (42): request completed {"reqId":1437,"req":{"id":1437,"method":"GET","url":"/ws?session=*&events=session.status&x-api-key=mhaileOkoa%402025","query":{"session":"*","events":"session.status","x-api-key":"mhaileOkoa@2025"},"params":{"path":["ws"]}},"res":{"statusCode":404},"responseTime":1}

Screenshots

Image
version: "3.8"

services:
  waha:
    image: devlikeapro/waha:latest
    container_name: waha-prod
    restart: unless-stopped
    shm_size: "2gb"   # more shared memory to prevent Chrome crashes
    ports:
      - "7000:3000"
    environment:
      WHATSAPP_API_HOSTNAME: 0.0.0.0
      WHATSAPP_API_PORT: 3000
      WAHA_LOG_LEVEL: debug

    volumes:
      - ./sessions:/sessions   # bind mount for persistent sessions

NathyG2524 avatar Sep 19 '25 06:09 NathyG2524

Same here

mubarekmuhiyie avatar Sep 19 '25 06:09 mubarekmuhiyie

Using docker compose to run waha

mubarekmuhiyie avatar Sep 19 '25 06:09 mubarekmuhiyie

Same here +1

mmexploit avatar Sep 19 '25 06:09 mmexploit

Same here

devkeno21 avatar Sep 19 '25 06:09 devkeno21

+1

devkeno21 avatar Sep 19 '25 06:09 devkeno21

am also having the same issue

samuel-T12 avatar Sep 19 '25 06:09 samuel-T12

Hi Everyone - Is your whatsapp and your virtual machine (where you host WAHA) in the same country? Because waha can face issues if it is not.

patron:PLUS

normalscene avatar Sep 24 '25 13:09 normalscene

I have Waha on my local server, and it's failing the same way. Same IP, router, etc.

djjul avatar Sep 24 '25 15:09 djjul

Hi Everyone - Is your whatsapp and your virtual machine (where you host WAHA) in the same country? Because waha can face issues if it is not.

patron:PLUS

Good Point, but it makes atm no difference for us since the issue is local and on the server, also we are using server outside our country but local residential proxys so it shouldt matter atm..

patron:PLUS

MiwiDots avatar Sep 25 '25 05:09 MiwiDots

Hi!

shm_size: "2gb"

Try to remove this, it should be 2CPU and 4GB memory available minimun

Could you try to add

WAHA_RUN_XVFB=false

and start all over again?

and

WAHA_WEBJS_PUPPETER_ARGS=--single-process

and both

patron:PRO

devlikepro avatar Sep 25 '25 07:09 devlikepro

Same here

patron:PRO

yosif111 avatar Oct 06 '25 15:10 yosif111

Portuguese


Mesmo aqui

github-actions[bot] avatar Oct 06 '25 15:10 github-actions[bot]

Hi Everyone - Is your whatsapp and your virtual machine (where you host WAHA) in the same country? Because waha can face issues if it is not.

patron:PLUS

yeah they are in a different country using a proxy actually solved it

NathyG2524 avatar Oct 08 '25 15:10 NathyG2524

Portuguese


Olá a todos - Seu WhatsApp e sua máquina virtual (onde você hospeda o WAHA) estão no mesmo país? Porque waha pode enfrentar problemas se não for.

![patrono:PLUS](https://camo.githubusercontent.com/f2a0b7f7aaa0c26af112ef46229c9b6d343fec757c08f78ef210a4894d290146/68747470733a2f2f696 d672e736869656c64732e696f2f62616467652f706174726f6e2d504c55532d613065366261)

sim, eles estão em um país diferente usando um proxy, na verdade resolveu o problema

github-actions[bot] avatar Oct 08 '25 15:10 github-actions[bot]