venom: Cannot read property 'createWid' of undefined

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 (<anonymous>:1:64760) at Object.window.WAPI.window.WAPI.sendExist (<anonymous>:1:29715) at Object.window.WAPI.window.WAPI.sendMessage (<anonymous>: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

  • Venom version(s): [Latest]
  • Browser: Versão 90.0.4430.212 (Versão oficial) 64 bits
  • OS: Windows 10
  • Node version: Node: v14.16.0

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

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 16 (2 by maintainers)

Commits related to this issue

Most upvoted comments

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 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?