I'm getting this error when I try to send media messages with videos
(node:916) UnhandledPromiseRejectionWarning: Error: Evaluation failed: t
at ExecutionContext._evaluateInternal (C:\Projetos\gartic-whatsapp-bot\node_modules\puppeteer\lib\cjs\puppeteer\common\ExecutionContext.js:217:19)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at ExecutionContext.evaluate (C:\Projetos\gartic-whatsapp-bot\node_modules\puppeteer\lib\cjs\puppeteer\common\ExecutionContext.js:106:16)
at Client.sendMessage (C:\Projetos\gartic-whatsapp-bot\node_modules\whatsapp-web.js\src\Client.js:469:28)
at PassThrough.<anonymous> (C:\Projetos\gartic-whatsapp-bot\src\controllers\YoutubeController.ts:168:9)
(node:916) 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: 1)
(node:916) [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.
My code looks like this:
const file = 'C:/absolute/path/to/file.mp4'
const media = MessageMedia.fromFilePath(file);
await msg.reply(media);
I'm using this version of the library: whatsapp-web.js": "^1.11.0
It's worth mention that I'm trying to send a 1.8mb video, so I don't think the size is the problem
Solved. In order to send videos you have to give puppeteer the path to a separately installed Chrome browser
const client = new Client({
puppeteer: {
executablePath: '/path/to/Chrome',
}
})
I think this should be in the readme.
Most helpful comment
Solved. In order to send videos you have to give puppeteer the path to a separately installed Chrome browser
I think this should be in the readme.