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] - Duplicate Message Delivery Due to Promise was collected Error in whatsapp-web.js #714

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

Comments

@Sabyrzhanuly
Copy link

Sabyrzhanuly commented Dec 29, 2024

When sending text through the whatsapp-web.js library, an error occurs: Protocol error (Runtime.callFunctionOn): Promise was collected. Despite the error, the message is successfully delivered. However, due to the error, the system treats the request as failed and re-sends the message, causing duplicate deliveries.

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

logs

      "request": {
        "body": {
          "text": "Test message",
          "chatId": "77771669474",
          "session": "4849012"
        },
        "path": "/api/sendText",
        "query": {
          
        },
        "method": "POST"
      },
      "version": {
        "tier": "PLUS",
        "engine": "WEBJS",
        "browser": "/usr/bin/chromium",
        "version": "2024.12.1"
      },
      "exception": {
        "name": "ProtocolError",
        "stack": "ProtocolError: Protocol error (Runtime.callFunctionOn): Promise was collected\n    at <instance_members_initializer> (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/common/CallbackRegistry.js:94:14)\n    at new Callback (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/common/CallbackRegistry.js:98:16)\n    at CallbackRegistry.create (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/common/CallbackRegistry.js:23:26)\n    at Connection._rawSend (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/Connection.js:90:26)\n    at CdpCDPSession.send (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/CDPSession.js:66:33)\n    at #evaluate (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/ExecutionContext.js:360:50)\n    at ExecutionContext.evaluate (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/ExecutionContext.js:275:36)\n    at IsolatedWorld.evaluate (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/IsolatedWorld.js:100:30)\n    at CdpFrame.evaluate (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/api/Frame.js:341:43)\n    at CdpFrame.<anonymous> (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/util/decorators.js:104:27)\n    at CdpPage.evaluate (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/api/Page.js:807:43)\n    at WebjsClient.sendMessage (/app/node_modules/whatsapp-web.js/src/Client.js:956:44)\n    at WhatsappSessionWebJSPlus.sendText (/app/dist/core/engines/webjs/session.webjs.core.js:289:30)\n    at ChattingController.sendText (/app/dist/api/chatting.controller.js:30:25)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)",
        "message": "Protocol error (Runtime.callFunctionOn): Promise was collected"
      },
      "timestamp": "2024-12-29T09:09:41.740Z",
      "statusCode": 500
    }
  }

patron:PLUS

@Sabyrzhanuly Sabyrzhanuly added the bug Something isn't working label Dec 29, 2024
@Sabyrzhanuly
Copy link
Author

Sabyrzhanuly commented Dec 30, 2024

@devlikepro

Could you please take a look at this issue? The error leads to duplicate message deliveries, which impacts the messaging process reliability. Let me know if you need more details or logs to diagnose the problem.

patron:PLUS

@devlikepro
Copy link
Contributor

devlikepro commented Dec 30, 2024

Hi! We'll double check that ASAP!

patron:PRO

@devlikepro
Copy link
Contributor

devlikepro commented Dec 30, 2024

Related #244

patron:PRO

@devlikepro
Copy link
Contributor

devlikepro commented Dec 30, 2024

ProtocolError: Protocol error (Runtime.callFunctionOn): Promise was collected
    at <instance_members_initializer> (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/common/CallbackRegistry.js:94:14)
    at new Callback (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/common/CallbackRegistry.js:98:16)
    at CallbackRegistry.create (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/common/CallbackRegistry.js:23:26)
    at Connection._rawSend (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/Connection.js:90:26)
    at CdpCDPSession.send (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/CDPSession.js:66:33)
    at #evaluate (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/ExecutionContext.js:360:50)
    at ExecutionContext.evaluate (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/ExecutionContext.js:275:36)
    at IsolatedWorld.evaluate (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/IsolatedWorld.js:100:30)
    at CdpFrame.evaluate (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/api/Frame.js:341:43)
    at CdpFrame.<anonymous> (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/util/decorators.js:104:27)
    at CdpPage.evaluate (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/api/Page.js:807:43)
    at WebjsClient.sendMessage (/app/node_modules/whatsapp-web.js/src/Client.js:956:44)
    at WhatsappSessionWebJSPlus.sendText (/app/dist/core/engines/webjs/session.webjs.core.js:289:30)
    at ChattingController.sendText (/app/dist/api/chatting.controller.js:30:25)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)

patron:PRO

@Sabyrzhanuly
Copy link
Author

Sabyrzhanuly commented Dec 30, 2024

Related #244

patron:PRO

Will this issue be addressed in any way? Because it’s causing significant disruption.
Or are there any alternative workarounds?

patron:PLUS

@Sabyrzhanuly
Copy link
Author

Sabyrzhanuly commented Jan 3, 2025

Is there a solution? Could you please advise? @devlikepro

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 patron:PLUS
Projects
None yet
Development

No branches or pull requests

2 participants