orkestral / venom

Venom is a high-performance system developed with JavaScript to create a bot for WhatsApp, support for creating any interaction, such as customer service, media sending, sentence recognition based on artificial intelligence and all types of design architecture for WhatsApp.
https://orkestral.io
Apache License 2.0
6.03k stars 1.17k forks source link

Cannot read property 'createWid' of undefined #923

Closed allancmello closed 3 years ago

allancmello commented 3 years ago

The error message is shown after reading the "Oi" sent by the smartphone's whatsapp. This is the sample code taken from the Venom-bot documentation.

(node:18028) UnhandledPromiseRejectionWarning: Error: Evaluation failed: TypeError: Cannot read property 'createWid' of undefined at Object.window.WAPI.window.WAPI.checkNumberStatus (:1:64760) at Object.window.WAPI.window.WAPI.sendExist (:1:29715) at Object.window.WAPI.window.WAPI.sendMessage (:1:38155) at puppeteer_evaluation_script:3:57 at ExecutionContext._evaluateInternal (D:\desenv\Frameworks\APIs Backend\Laboratorio\nest\venom\node_modules\puppeteer\lib\cjs\puppeteer\common\ExecutionContext.js:217:19) at processTicksAndRejections (internal/process/task_queues.js:93:5) at async ExecutionContext.evaluate (D:\desenv\Frameworks\APIs Backend\Laboratorio\nest\venom\node_modules\puppeteer\lib\cjs\puppeteer\common\ExecutionContext.js:106:16) (Use node --trace-warnings ... to show where the warning was created) (node:18028) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2) (node:18028) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. [Description of the bug, When Issue Happens]

Environment

Windows 10

Steps to Reproduce

  1. [First Step]
  2. [Second Step]
  3. [and so on...]

Log Output

Your Code

import { Controller, Get } from '@nestjs/common'; import { AppService } from './app.service'; import { create } from 'venom-bot';

@Controller() export class AppController { constructor(private readonly appService: AppService) {}

@Get() getStart(): void {

create('vendas')
.then((client) => start(client))
.catch((erro) => {
  console.log(erro);
});

function start(client) { client.onMessage((message) => { if (message.body === 'Oi' && message.isGroupMsg === false) { client .sendText(message.from, 'Bem Vindo ao Venom 🕷') .then((result) => { console.log('Result: ', result); //return object success }) .catch((erro) => { console.error('Erro ao enviar: ', erro); //return object error }); } }); }
} }

image

bhavya32 commented 3 years ago

@allancmello Is this error still coming?

eduardorangell commented 3 years ago

I think he solved this. IIRC he asked some help on telegram group. @allancmello was you the one who i shared a simple NestJS Venom example?

tmsbrasil commented 3 years ago

I´m having the same problem. Anybody found a solution?

eduardorangell commented 3 years ago

I’ve tested with a clean installation with "Getting started" code example and it worked as expected. Try to delete package-lock.json file, node_modules folder and npm install again.

reinaldoalmeida commented 3 years ago

I´m having the same problem. Anybody found a solution?

bhavya32 commented 3 years ago

@eduardorangell Please note that WhatsApp is slowly rolling out a change. So not everyone is getting that.

tmsbrasil commented 3 years ago

I’ve tested with a clean installation with "Getting started" code example and it worked as expected. Try to delete package-lock.json file, node_modules folder and npm install again.

I tried this, but without success. I´m still recieving the same error:

(node:31884) UnhandledPromiseRejectionWarning: Error: Evaluation failed: TypeError: Cannot read property 'createWid' of undefined at Object.window.WAPI.window.WAPI.checkNumberStatus (C:\Users\DELL\Documents\Tiago\Dev\W3Interativa\api-salesbot-venom\node_modules\venom-bot\dist\lib\wapi\wapi.js:1:64760)

allancmello commented 3 years ago

No, it appears to have been a node_modules libs corruption error.

Resolved by exemple in telegram group.

tmsbrasil commented 3 years ago

In my case, I just deleted the JSON from the session created in the TOKENS folder and solved it.

AzamatIshmuratov commented 3 years ago

In my case, I just deleted the JSON from the session created in the TOKENS folder and solved it.

Thanks!

jonalan7 commented 3 years ago

This problem has been fixed!

JhefersonBR commented 1 year ago

None of the suggestions worked for me.

luthfifadle commented 1 year ago

None of the suggestions worked for me.

me to.. i try to change the version and delete Tokens folder its work, but if i restart the system that error show again

rodrigooliver commented 1 year ago

Problem reappeared. When I delete the 'node_modules' folder, it works again for a little while, but then the error reappears:

Error: Evaluation failed: TypeError: Cannot read property 'isWidlike' of undefined

suhrab commented 1 year ago

Problem reappeared. When I delete the 'node_modules' folder, it works again for a little while, but then the error reappears:

Error: Evaluation failed: TypeError: Cannot read property 'isWidlike' of undefined

I worked again after I removed 2 directories: node_modules, tokens

felipe-palmadias commented 1 year ago

None of the suggestions worked for me.