Closed bhejosms closed 3 years ago
const client = new Client({ qrTimeoutMs:0 });
use .catch
on initialize... this will supress this warning
eg:
let whatsapp = new Client();
whatsapp.initialize().catch((_) => _);
const client = new Client({ qrTimeoutMs:0 });
This solves my problem. Thank you
Some time when some one scan QR code it get scanned on phone it shows login but session.json file is not created as well as logs shows below exception
(node:12694) UnhandledPromiseRejectionWarning: TimeoutError: waiting for selector)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:12694) 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
canvas
failed: timeout 45000ms exceeded at new WaitTask (/home/cspl/Desktop/Whatsapp/WhatsappAPI/node_modules/puppeteer/lib/cjs/puppeteer/common/DOMWorld.js:505:34) at DOMWorld.waitForSelectorInPage (/home/cspl/Desktop/Whatsapp/WhatsappAPI/node_modules/puppeteer/lib/cjs/puppeteer/common/DOMWorld.js:416:26) at Object.internalHandler.waitFor (/home/cspl/Desktop/Whatsapp/WhatsappAPI/node_modules/puppeteer/lib/cjs/puppeteer/common/QueryHandler.js:31:77) at DOMWorld.waitForSelector (/home/cspl/Desktop/Whatsapp/WhatsappAPI/node_modules/puppeteer/lib/cjs/puppeteer/common/DOMWorld.js:312:29) at Frame.waitForSelector (/home/cspl/Desktop/Whatsapp/WhatsappAPI/node_modules/puppeteer/lib/cjs/puppeteer/common/FrameManager.js:842:51) at Page.waitForSelector (/home/cspl/Desktop/Whatsapp/WhatsappAPI/node_modules/puppeteer/lib/cjs/puppeteer/common/Page.js:1285:33) at Timeout.getQrCode [as _onTimeout] (/home/cspl/Desktop/Whatsapp/WhatsappAPI/node_modules/whatsapp-web.js/src/Client.js:128:28) at runMicrotasks (--unhandled-rejections=strict
(see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 34)