open-wa / wa-automate-nodejs

💬 🤖 The most reliable tool for chatbots with advanced features. Be sure to 🌟 this repository for updates!
https://docs.openwa.dev/
Other
3.1k stars 590 forks source link

Execution context was destroyed after Opening/Pairing/Connected #2599

Closed t0g3pii closed 2 years ago

t0g3pii commented 2 years ago

Are you using the latest version of the library?

What type of session are you experiencing this issue on?

Multi-device and I have set multiDevice to true in my config OR am using the --multi-device flag

What type of host account are you experiencing this issue on?

Business account

Mode

My own code

Current Behavior

After starting my Code, the Bot seems to "disconnect" after ~5 mins and reconnects instantly

[Client State] - T0G3_PRIV_BS - OPENING [Client State] - T0G3_PRIV_BS - PAIRING [Client State] - T0G3_PRIV_BS - CONNECTED

then there occures a puppeteer crash.

[ERROR] ProtocolError: Protocol error (Runtime.callFunctionOn): Execution context was destroyed. at C:\Users\Admin\Desktop\Bots\Main\node_modules\puppeteer\lib\cjs\puppeteer\common\Connection.js:230:24 at new Promise (<anonymous>) at CDPSession.send (C:\Users\Admin\Desktop\Bots\Main\node_modules\puppeteer\lib\cjs\puppeteer\common\Connection.js:226:16) at ExecutionContext._evaluateInternal (C:\Users\Admin\Desktop\Bots\Main\node_modules\puppeteer\lib\cjs\puppeteer\common\ExecutionContext.js:204:50) at ExecutionContext.evaluate (C:\Users\Admin\Desktop\Bots\Main\node_modules\puppeteer\lib\cjs\puppeteer\common\ExecutionContext.js:110:27) at DOMWorld.evaluate (C:\Users\Admin\Desktop\Bots\Main\node_modules\puppeteer\lib\cjs\puppeteer\common\DOMWorld.js:97:24) at runMicrotasks (<anonymous>) at processTicksAndRejections (internal/process/task_queues.js:97:5) { originalMessage: 'Execution context was destroyed.' }

Expected Behavior

no crash lul. <3

Steps To Reproduce

Win10 - 64 Bit Node 12.22.1 wa-automate-nodejs 4.32.17 wa_version: 2.2208.14 browser_version: HeadlessChrome/99.0.4844.82 page_ua: WhatsApp/2.2147.16 Mozilla/5.0 (Macintosh; Intel Mac OS X 11_2_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36

create() code

var _t0g3_priv_lic = "REMOVED_FOR_GITHUB";
var md = true
const hosts = ["T0G3_PRIV_BS"];
for (var i = 0; i < hosts.length; i++) {
    if (hosts[i] != 'T0G3_PRIV_BS') { _t0g3_priv_lic = undefined; md = false }
    create({
        "licenseKey": _t0g3_priv_lic,
        "headless": true,
        "cacheEnabled": true,
        "useChrome": true,
        "restartOnCrash": startServer,
        "qrTimeout": 0,
        "authTimeout": 120,
        "sessionId": hosts[i],
        "sesseionDataPath": '../Sessions',
        "multiDevice": md,
        "cachedPatch": true,
        "skipBrokenMethodsCheck": true,
        "blockAssets": true,
        "skipUpdateCheck": true,
        "disableSpins": false,
        "discord": "907573119433187329"
    })
        .then(async (client) => startServer(client))
        .catch((error) => console.log(error))
}

DEBUG INFO

{
  "WA_VERSION": "2.2208.14",
  "WA_AUTOMATE_VERSION": "4.32.17",
  "BROWSER_VERSION": "HeadlessChrome/99.0.4844.82",
  "START_TS": 1648395831273,
  "LATEST_VERSION": true,
  "CLI": false
}

Environment

- OS: Windows 10
- Node: 12.22.1
- npm: 7.20.5

Screenshots/Logs

No response

Anything else?

Ping me on Discord if you need further Information ƬӨGΣPII#1337

t0g3pii commented 2 years ago

Aditional Info: seems like chrome window entirely freezes. dont know why but then after a few mins that error occurs^^ i have this issue on 3 different machines on 2 different numbers currently, doesnt care if business or legacy, both md and both latest beta

smashah commented 2 years ago

@t0g3pii might sound dumb but have you tried restarting your machines and trying again?