venom: Problema ao criar sessao

Description

após criar a sessão está ocorrendo este erro

There was an error in the bot Error: Evaluation failed: TypeError: Cannot read property ‘default’ of undefined at Object.window.WAPI.window.WAPI.restartService (G:\projetos\valdeci\node_modules\venom-bot\dist\lib\wapi\wapi.js:1:57963) at puppeteer_evaluation_script:1:28 at ExecutionContext._evaluateInternal (G:\projetos\valdeci\node_modules\puppeteer\lib\cjs\puppeteer\common\ExecutionContext.js:217:19) at runMicrotasks (<anonymous>) at processTicksAndRejections (internal/process/task_queues.js:93:5) at async ExecutionContext.evaluate (G:\projetos\valdeci\node_modules\puppeteer\lib\cjs\puppeteer\common\ExecutionContext.js:106:16)

[Description of the bug, When Issue Happens]

Environment

  • Venom version(s): 2.2.6
  • Browser: Chrome
  • OS: Windows 10
  • Node version: Node 14

Steps to Reproduce

  1. [First Step] Criar sessao venom
If relevant, paste all of your Log Output

Your Code

bot.create(
           //session
           'sessionName', //Pass the name of the client you want to start the bot
           //catchQR
           (base64Qrimg, asciiQR, attempts, urlCode) => {
             console.log('Number of attempts to read the qrcode: ', attempts);
             console.log('Terminal qrcode: ', asciiQR);
             console.log('base64 image string qrcode: ', base64Qrimg);
             console.log('urlCode (data-ref): ', urlCode);
           },
           // statusFind
           (statusSession, session) => {
             console.log('Status Session: ', statusSession); //return isLogged || notLogged || browserClose || qrReadSuccess || qrReadFail || autocloseCalled || desconnectedMobile || deleteToken
             //Create session wss return "serverClose" case server for close
             console.log('Session name: ', session);
           },
           // options
           {
             folderNameToken: 'tokens', //folder name when saving tokens
             mkdirFolderToken: '', //folder directory tokens, just inside the venom folder, example:  { mkdirFolderToken: '/node_modules', } //will save the tokens folder in the node_modules directory
             headless: true, // Headless chrome
             devtools: false, // Open devtools by default
             useChrome: true, // If false will use Chromium instance
             debug: false, // Opens a debug session
             logQR: true, // Logs QR automatically in terminal
             browserWS: '', // If u want to use browserWSEndpoint
             browserArgs: [''], // Parameters to be added into the chrome browser instance
             puppeteerOptions: {}, // Will be passed to puppeteer.launch
             disableSpins: true, // Will disable Spinnies animation, useful for containers (docker) for a better log
             disableWelcome: true, // Will disable the welcoming message which appears in the beginning
             updatesLog: true, // Logs info updates automatically in terminal
             autoClose: false, // Automatically closes the venom-bot only when scanning the QR code (default 60 seconds, if you want to turn it off, assign 0 or false)
             createPathFileToken: false, //creates a folder when inserting an object in the client's browser, to work it is necessary to pass the parameters in the function create browserSessionToken
           },
           // BrowserSessionToken
           // To receive the client's token use the function await client.getSessionTokenBrowser()
         )
         .then((client) => {
           let time = 0,
             started = false;
           client.onStreamChange((state) => {
             console.log('Connection status: ', state);
             clearTimeout(time);
             if (state === 'CONNECTED' && !started) {
               start(client);
               started = true;
             }
             //DISCONNECTED when the mobile device is disconnected
             if (state === 'DISCONNECTED' || state === 'SYNCING') {
               time = setTimeout(() => {
                 client.close();
                 // process.exit(); //optional function if you work with only one session
               }, 80000);
             }
           });
         })
         .catch((erro) => {
           console.log('There was an error in the bot', erro);
         });

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 1
  • Comments: 34 (5 by maintainers)

Most upvoted comments

o wpp atualizou o webpack, o pessoal está na correria pra tentar corrigir… =/

Forcem a atualização npm install venom-bot@3.0.0 já está funcionando

Subiram uma correção hoje no open-wa, por isso ele está funcional

Forcem a atualização npm install venom-bot@3.0.0 já está funcionando

testamos aqui não foi

Testando atualizar com Yarn erro permanece, alguma sugestão?

Aqui estava com erro para atualizar, exclui a pasta do node_modules e dei um yarn… Funciou, mas está com o problema de duplicação no onMessage #639

Acredito que seja algum problema no repositório, não uma alteração no sistema do whatsapp pois usando outro método como o OPEN-WA que também usa puppeteer ainda esta funcional

Testando atualizar com Yarn erro permanece, alguma sugestão?

Aqui estava com erro para atualizar, exclui a pasta do node_modules e dei um yarn… Funciou, mas está com o problema de duplicação no onMessage #639

Então, eu fiz isso também, mas parece que ele não baixa a ultima versão, tem alguma ideia? 😛

Da algum erro após o yarn? Alterou o package.json?

@igortrust obrigado pela ajuda, no fim das contas era porque eu estava usando o NVM, não sei porque mas o puppeteer não tava identificando o node atualizado que estava no NVM, parei de usar ele (e atualizei o da maquina e funcionou)

Ninguém mais com a #639 ?

Forcem a atualização npm install venom-bot@3.0.0 já está funcionando

Aqui deu certo muito obrigado ❤️

Pode me falar onde você substituiu com o open-wa por favor?

https://github.com/open-wa/wa-automate-nodejs