Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG][WEBJS] - TargetCloseError: Unexpected Closure of Puppeteer Browser Session During Contact Check #685

Open
Sabyrzhanuly opened this issue Dec 7, 2024 · 8 comments
Labels
bug Something isn't working engine:WEBJS patron:PLUS

Comments

@Sabyrzhanuly
Copy link

Sabyrzhanuly commented Dec 7, 2024

Describe the Bug

When attempting to check the existence of a contact using the /api/contacts/check-exists endpoint, an error occurs because the browser session unexpectedly closes. The Puppeteer library throws a "Protocol error (Runtime.callFunctionOn): Target closed" exception, which interrupts the WebJS session.


Title

"TargetCloseError: Puppeteer Browser Session Closed Unexpectedly During Contact Check"


Version

{
  "version": "2024.12.1",
  "engine": "WEBJS",
  "tier": "PLUS",
  "browser": "/usr/bin/chromium"
}

Docker logs

TargetCloseError: Protocol error (Runtime.callFunctionOn): Target closed at CallbackRegistry.clear (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/common/CallbackRegistry.js:73:36) at CdpCDPSession._onClosed (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/CDPSession.js:101:25) at #onClose (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/Connection.js:167:21) at Connection.dispose (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/Connection.js:173:22) at CdpBrowser.disconnect (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/Browser.js:230:26) at CdpBrowser.close (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/Browser.js:226:20) at async WebjsClient.destroy (/app/node_modules/whatsapp-web.js/src/Client.js:787:9)

patron:PLUS

@Sabyrzhanuly Sabyrzhanuly added the bug Something isn't working label Dec 7, 2024
@devlikepro
Copy link
Contributor

devlikepro commented Dec 9, 2024

Hi! Could you try to switch to chrome based image?
https://waha.devlike.pro/docs/how-to/engines/#docker-images

devlikeapro/waha-plus:chrome	

patron:PRO

@devlikepro
Copy link
Contributor

devlikepro commented Dec 9, 2024

Is there any error before that in docker logs, could you check?

docker compose logs

patron:PRO

@Sabyrzhanuly
Copy link
Author

Sabyrzhanuly commented Dec 9, 2024

Is there any error before that in docker logs, could you check?

docker compose logs

patron:PRO

I won't be able to view the logs anymore. I've limited the logs by time, and they are being erased.

patron:PLUS

@Sabyrzhanuly
Copy link
Author

Sabyrzhanuly commented Dec 9, 2024

Hi! Could you try to switch to chrome based image? https://waha.devlike.pro/docs/how-to/engines/#docker-images

devlikeapro/waha-plus:chrome	

patron:PRO

Hi
Will anything happen to my current sessions? I already have active working sessions at the moment

patron:PLUS

@devlikepro
Copy link
Contributor

devlikepro commented Dec 10, 2024

I've limited the logs by time, and they are being erased.

Do you mean you got the error only once or time to time, not always?
In this case yeah, that's fine, just add a retry logic. It happens when browser got closed due to some internal issues, we restart it automatically, but it takes time (like a few seconds). Probably the request came into those seconds

patron:PRO

@Sabyrzhanuly
Copy link
Author

Sabyrzhanuly commented Dec 10, 2024

I've limited the logs by time, and they are being erased.

Do you mean you got the error only once or time to time, not always? In this case yeah, that's fine, just add a retry logic. It happens when browser got closed due to some internal issues, we restart it automatically, but it takes time (like a few seconds). Probably the request came into those seconds

patron:PRO

It's possible, but such behavior occurred specifically when checking the number for existence. That's why I decided to report it. Thank you for your response!

patron:PLUS

@devlikepro
Copy link
Contributor

devlikepro commented Dec 14, 2024

specifically when checking the number for existence

How often do you request it? It could be because of rate limits on the WA side :(

patron:PRO

@Sabyrzhanuly
Copy link
Author

Sabyrzhanuly commented Dec 14, 2024

specifically when checking the number for existence

How often do you request it? It could be because of rate limits on the WA side :(

patron:PRO

Before sending a message, I check if the number exists. How else can this be done? I need to be sure whether the message was successfully sent or not.

patron:PLUS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working engine:WEBJS patron:PLUS
Projects
None yet
Development

No branches or pull requests

2 participants