wppconnect-team / wppconnect

WPPConnect is an open source project developed by the JavaScript community with the aim of exporting functions from WhatsApp Web to the node, which can be used to support the creation of any interaction, such as customer service, media sending, intelligence recognition based on phrases artificial and many other things, use your imagination
https://wppconnect.io
Other
1.85k stars 320 forks source link

Chat not found #463

Closed igortrust closed 2 years ago

igortrust commented 3 years ago

Description

O código está sendo quebrado quando recebe um chat do brodcast.

Environment

Steps to Reproduce

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

Log Output

UnhandledRejection: Chat not found at Object. (C:\Users\igor\OneDrive\Documentos\Projetos\servidor\node_modules\@wppconnect-team\wppconnect\dist\api\helpers\evaluate-and-return.js:99:33) at step (C:\Users\igor\OneDrive\Documentos\Projetos\servidor\node_modules\@wppconnect-team\wppconnect\dist\api\helpers\evaluate-and-return.js:49:23) at Object.next (C:\Users\igor\OneDrive\Documentos\Projetos\servidor\node_modules\@wppconnect-team\wppconnect\dist\api\helpers\evaluate-and-return.js:30:53) at fulfilled (C:\Users\igor\OneDrive\Documentos\Projetos\servidor\node_modules\@wppconnect-team\wppconnect\dist\api\helpers\evaluate-and-return.js:21:58) at processTicksAndRejections (internal/process/task_queues.js:93:5) If relevant, paste all of your Log Output

#######

1|alessandra | Error: Chat not found 1|alessandra | at Object. (/home/kvm/Git/node_modules/@wppconnect-team/wppconnect/dist/api/helpers/evaluate-and-return.js:99:33) 1|alessandra | at step (/home/kvm/Git/node_modules/@wppconnect-team/wppconnect/dist/api/helpers/evaluate-and-return.js:49:23) 1|alessandra | at Object.next (/home/kvm/Git/node_modules/@wppconnect-team/wppconnect/dist/api/helpers/evaluate-and-return.js:30:53) 1|alessandra | at fulfilled (/home/kvm/Git/node_modules/@wppconnect-team/wppconnect/dist/api/helpers/evaluate-and-return.js:21:58) 1|alessandra | at processTicksAndRejections (node:internal/process/task_queues:93:5) { 1|alessandra | error: true, 1|alessandra | code: 'chat_not_found', 1|alessandra | chatId: 'status@broadcast', 1|alessandra | name: 'UnhandledRejection' 1|alessandra | }

edgardmessias commented 3 years ago

@igortrust , poderia dar mais detalhes? Testou versão mais recente do WPP?

igortrust commented 3 years ago

@

@igortrust , poderia dar mais detalhes? Testou versão mais recente do WPP?

@edgardmessias , excluí a pasta do node_modules e reinstalei a versão 1.8.13 no windows e ubuntu… Mas o erro permanece.

Refiz o create para tentar rastrear o possível erro, mas não consegui achar o padrão que causa o erro…

bot.create({ session: 'Revita', //Pass the name of the client you want to start the bot logger: logger, 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);

}, 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 browserArgs: ['--js-flags="--max_old_space_size=80" --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'], // Parameters to be added into the chrome browser instance refreshQR: 15000, // Will refresh QR every 15 seconds, 0 will load QR once. Default is 30 seconds autoClose: 60000, // Will auto close automatically if not synced, 'false' won't auto close. Default is 60 seconds (#Important!!! Will automatically set 'refreshQR' to 1000#) disableSpins: true, // Will disable Spinnies animation, useful for containers (docker) for a better log }).then((client) => start(client));

makanSukros commented 3 years ago

Yes, this problem on multi-devices beta activated

makanSukros commented 3 years ago

@

@igortrust , poderia dar mais detalhes? Testou versão mais recente do WPP?

@edgardmessias , excluí a pasta do node_modules e reinstalei a versão 1.8.13 no windows e ubuntu… Mas o erro permanece.

Refiz o create para tentar rastrear o possível erro, mas não consegui achar o padrão que causa o erro…

bot.create({ session: 'Revita', //Pass the name of the client you want to start the bot logger: logger, 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);

}, 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 browserArgs: ['--js-flags="--max_old_space_size=80" --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'], // Parameters to be added into the chrome browser instance refreshQR: 15000, // Will refresh QR every 15 seconds, 0 will load QR once. Default is 30 seconds autoClose: 60000, // Will auto close automatically if not synced, 'false' won't auto close. Default is 60 seconds (#Important!!! Will automatically set 'refreshQR' to 1000#) disableSpins: true, // Will disable Spinnies animation, useful for containers (docker) for a better log }).then((client) => start(client));

Dont join beta version

dcrec1 commented 2 years ago

It's possible to capture the exception or handle the promise so it doesn't bubble up and crashes node? I'm asking because this issue is crashing MyZap and we're having trouble finding a way to prevent this. I know a solution is not to join the beta version of MD, but the problem is that in some cases we can't prevent a customer from trying to read the QR code with the MD activated.

edgardmessias commented 2 years ago

@dcrec1 , I am investigating this issue, but I need help to discover what kind of event that was triggered by broadcast.

The basic solution is to create "broadcast chat", but I need know what is triggering this.

AlexandreDev06 commented 2 years ago

@edgardmessias Estou enfrentando o mesmo problema, quando autentico o meu WhatsApp pelo QRcode, ele mantem conectado por um tempo aleatório, depois ele cai e no Log me retorna: "Error: Chat not found for status@broadcast" Essa solução de criar um "broadcast chat", poderia resolver? E um broadcast chat seria criar uma broadcast dentro do WhatsApp ou pelo WppConnect?

dudanogueira commented 2 years ago

Mesmo erro aqui.

Logs: wppconnect_1 | Error: Chat not found for status@broadcast wppconnect_1 | at t.assertGetChat (/usr/src/server-cli/node_modules/@wppconnect/wa-js/dist/wppconnect-wa.js:2:73872) wppconnect_1 | at Object.t.markIsRead (/usr/src/server-cli/node_modules/@wppconnect/wa-js/dist/wppconnect-wa.js:2:95902) wppconnect_1 | at puppeteer_evaluation_script:56:69 wppconnect_1 | at puppeteer_evaluation_script:56:92 wppconnect_1 | at Y (https://web.whatsapp.com/bootstrap_qr.b9c65680b4522510f2dc.js:2:398157) wppconnect_1 | at new y (https://web.whatsapp.com/bootstrap_qr.b9c65680b4522510f2dc.js:2:390724) wppconnect_1 | at anonymous (puppeteer_evaluation_script:54:14)

edgardmessias commented 2 years ago

Fixed in https://github.com/wppconnect-team/wppconnect/releases/tag/v1.12.8