wppconnect-server icon indicating copy to clipboard operation
wppconnect-server copied to clipboard

WAPI is not defined

Open Saifallak opened this issue 2 years ago • 12 comments

Description

anytime i restart the server ( using CTRL+C and start it again ) or ( using pm2 restart ) or ( restarting whole server/VPS ) old session aren't working again, and no way to start them, only way to bypass it is by creating new session and giving up on old ones which breaks the system because have to scan qrcode over and over and over agian.

Similar Issues:

  • https://github.com/wppconnect-team/wppconnect-server/issues/909#issuecomment-1255039452 on #909
  • https://discord.com/channels/844351092758413353/844351724600688657/1021436871936577726
  • https://discord.com/channels/844351092758413353/844351724600688657/1021538719150395482
  • https://discord.com/channels/844351092758413353/844351724600688657/1022025194300248064
  • https://discord.com/channels/844351092758413353/844351724600688657/1022847492301258782

Environment

  • Wppconnect-server version(s): 1.6.2 ( latest on 24-sep-2022 )
  • Browser: Chromium and Chrome (105.0.5195.127)
  • OS: Windows 11 and Centos 6 and Ubuntu (tested on all them)
  • Node version: 14.18.1
  • WhatsApp version: 2.2234.13
  • WA-JS version: 2.12.0
  • MultiDevice (BETA): yes
  • config.json:
{
  "secretKey": "THISISMYSECURETOKEN",
  "host": "http://localhost",
  "port": "21465",
  "deviceName": "Localhost",
  "poweredBy": "Localhost-Server",
  "startAllSession": false,
  "tokenStoreType": "file",
  "maxListeners": 15,
  "customUserDataDir": "./userDataDir/",
  "webhook": {
    "url": "http://127.0.0.1:8000/api/internal-node",
    "autoDownload": false,
    "uploadS3": false,
    "readMessage": false,
    "allUnreadOnStart": false,
    "listenAcks": false,
    "onPresenceChanged": false,
    "onParticipantsChanged": false,
    "onReactionMessage": false
  },
  "archive": {
    "enable": false,
    "waitTime": 10,
    "daysToArchive": 45
  },
  "log": {
    "level": "error",
    "logger": ["console", "file"]
  },
  "createOptions": {
    "browserArgs": [
      "--disable-web-security",
      "--no-sandbox",
      "--disable-web-security",
      "--aggressive-cache-discard",
      "--disable-cache",
      "--disable-application-cache",
      "--disable-offline-load-stale-cache",
      "--disk-cache-size=0",
      "--disable-background-networking",
      "--disable-default-apps",
      "--disable-extensions",
      "--disable-sync",
      "--disable-translate",
      "--hide-scrollbars",
      "--metrics-recording-only",
      "--mute-audio",
      "--no-first-run",
      "--safebrowsing-disable-auto-update",
      "--ignore-certificate-errors",
      "--ignore-ssl-errors",
      "--ignore-certificate-errors-spki-list"
    ]
  },
  "mapper": {
    "enable": false,
    "prefix": "tagone-"
  },
  "db": {
    "mongodbDatabase": "tokens",
    "mongodbCollection": "",
    "mongodbUser": "",
    "mongodbPassword": "",
    "mongodbHost": "",
    "mongoIsRemote": true,
    "mongoURLRemote": "",
    "mongodbPort": 27017,
    "redisHost": "localhost",
    "redisPort": 6379,
    "redisPassword": "",
    "redisDb": 0,
    "redisPrefix": "docker"
  }
}

Steps to Reproduce

  1. Open server
  2. link whatsapp
  3. restart server somehow
  4. start same session ( or it will auto start if specified in config )

Log Output

[nodemon] restarting due to changes...
[nodemon] starting `babel-node src/server.js`
info: 2022-09-24T14:16:18.025Z Server is running on port: 21465
info: 2022-09-24T14:16:18.028Z  Visit http://localhost:21465/api-docs for Swagger docs
info: 2022-09-24T14:16:18.029Z WPPConnect-Server version: 1.6.2
info:     
  _       ______  ____  ______                            __
  | |     / / __ \/ __ \/ ____/___  ____  ____  ___  _____/ /_
  | | /| / / /_/ / /_/ / /   / __ \/ __ \/ __ \/ _ \/ ___/ __/
  | |/ |/ / ____/ ____/ /___/ /_/ / / / / / / /  __/ /__/ /_
  |__/|__/_/   /_/    \____/\____/_/ /_/_/ /_/\___/\___/\__/
info:     Checking for updates
info:     You're up to date
info:     [9757b00d-d707-4dfd-8704-f0dae87b0eac:browser] Using browser folder './userDataDir/9757b00d-d707-4dfd-8704-f0dae87b0eac'
info:     [9757b00d-d707-4dfd-8704-f0dae87b0eac:browser] Initializing browser...
info:     [9757b00d-d707-4dfd-8704-f0dae87b0eac:client] Initializing...
info:     [9757b00d-d707-4dfd-8704-f0dae87b0eac:client] Auto close configured to 60s
info: 2022-09-24T14:17:16.217Z isLogged


info:     [9757b00d-d707-4dfd-8704-f0dae87b0eac:client] Auto close configured to 60s
info: 2022-09-24T14:17:16.477Z inChat


error: 2022-09-24T14:17:16.704Z WAPI is not defined - Error: WAPI is not defined
    at C:\Users\Saif\IdeaProjects\wppconnect-server\node_modules\@wppconnect-team\wppconnect\dist\api\helpers\evaluate-and-return.js:106:31
    at step (C:\Users\Saif\IdeaProjects\wppconnect-server\node_modules\@wppconnect-team\wppconnect\dist\api\helpers\evaluate-and-return.js:49:23)
    at Object.next (C:\Users\Saif\IdeaProjects\wppconnect-server\node_modules\@wppconnect-team\wppconnect\dist\api\helpers\evaluate-and-return.js:30:53)
    at fulfilled (C:\Users\Saif\IdeaProjects\wppconnect-server\node_modules\@wppconnect-team\wppconnect\dist\api\helpers\evaluate-and-return.js:21:58)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
JS Stack: ReferenceError: WAPI is not defined
    at pptr://__puppeteer_evaluation_script__:56:47
    at pptr://__puppeteer_evaluation_script__:56:77
    at Y (https://web.whatsapp.com/bootstrap_qr.c8a228a8ac9e7fc0fc33.js:40:119374)
    at new y (https://web.whatsapp.com/bootstrap_qr.c8a228a8ac9e7fc0fc33.js:40:111941)
    at anonymous (pptr://__puppeteer_evaluation_script__:54:14)

Your Code

none

Additional context / Screenshot

none

Saifallak avatar Sep 24 '22 14:09 Saifallak

I'm also having this problem.

dcrec1 avatar Sep 26 '22 01:09 dcrec1

I am also facing same issue. although its connected but if you check the status it shows {"status":"INITIALIZING","version":"1.6.2"}

prashantnirgun avatar Sep 26 '22 07:09 prashantnirgun

Maybe fixed by https://github.com/wppconnect-team/wppconnect/pull/1340 ? .. not sure, will test tomorrow.

Saifallak avatar Sep 26 '22 17:09 Saifallak

Não esta corrigido, segue apresentando o mesmo problema!

nyoakaway avatar Sep 27 '22 20:09 nyoakaway

para mim tbm o mesmo problema. the same problem...

allisonwilliancandido avatar Sep 28 '22 13:09 allisonwilliancandido

Same problem is ocurring on windows o.s.

I Have tried changing "allUnreadOnStart": true or false, with same results

PS: This problem started after updating to 1.17.0.

tessarolli avatar Sep 28 '22 15:09 tessarolli

Same problem is ocurring on windows o.s.

I Have tried changing "allUnreadOnStart": true or false, with same results

PS: This problem started after updating to 1.17.0.

Good to know about it, i'll revert to older versions, maybe will fix. i'm fully updated too.

leohturbo avatar Sep 30 '22 20:09 leohturbo

Same problem is ocurring on windows o.s. I Have tried changing "allUnreadOnStart": true or false, with same results PS: This problem started after updating to 1.17.0.

Good to know about it, i'll revert to older versions, maybe will fix. i'm fully updated too.

So, any luck? Is it fixed?

Saifallak avatar Oct 01 '22 14:10 Saifallak

Same problem is ocurring on windows o.s. I Have tried changing "allUnreadOnStart": true or false, with same results PS: This problem started after updating to 1.17.0.

Good to know about it, i'll revert to older versions, maybe will fix. i'm fully updated too.

So, any luck? Is it fixed?

Don't have tested yet, test it by yourself.

leohturbo avatar Oct 01 '22 19:10 leohturbo

same issue please fix it in the lastest version

rsaisankalp avatar Oct 11 '22 21:10 rsaisankalp

Could you test with latest release?

edgardmessias avatar Oct 12 '22 16:10 edgardmessias

Yes tested with latest not fixed yet

rsaisankalp avatar Oct 13 '22 01:10 rsaisankalp

1.15.0 working well here by now, i'll keep testing it, any issues i'll let all of u know. tks.

  • not tested latest yet, but i'll keep using 1.15.0 for some time, that's a perfect version *

leohturbo avatar Oct 18 '22 15:10 leohturbo

This has been fixed in version 1.6.4

icleitoncosta avatar Oct 22 '22 00:10 icleitoncosta