WAPI is not defined

See original GitHub issue

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:

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

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:14 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
icleitoncostacommented, Oct 22, 2022

This has been fixed in version 1.6.4

1reaction
dcrec1commented, Sep 26, 2022

I’m also having this problem.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ReferenceError: WAPI is not defined while sending Text to ...
ReferenceError : WAPI is not defined while sending Text to existing ... I Modify wapi script, its working bot sending and reply message...
Read more >
Evaluation failed: ReferenceError: WAPI is not defined #1265
IssueHunt = OSS Development ⚒ + Bounty Program . IssueHunt is an issue-based bounty platform for open source projects. Anyone can put a...
Read more >
WAPI is not defined while sending Text to existing number
ReferenceError : WAPI is not defined while sending Text to existing number.
Read more >
Infoblox WAPI 2.11.2 documentation - IPAM
Note that this is not intended to be a schema as defined by JSON or XML standards. If a WAPI schema is requested...
Read more >
wapi Documentation - Read the Docs for Business
TAGGED curves contain a timeseries for each defined tag. ... this is not guaranteed to be long-term stable and will be removed in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found