open-wa / wa-automate-nodejs

💬 🤖 The most reliable tool for chatbots with advanced features. Be sure to 🌟 this repository for updates!
https://docs.openwa.dev/
Other
3.11k stars 588 forks source link

SendAudio/sendFile is crashing for some links/files #2598

Closed shifoc closed 2 years ago

shifoc commented 2 years ago

Are you using the latest version of the library?

What type of session are you experiencing this issue on?

Multi-device and I have set multiDevice to true in my config OR am using the --multi-device flag

What type of host account are you experiencing this issue on?

Business account

Mode

My own code

Current Behavior

sending Files/audios is crashing the program

PS: although I am using a business account, the library seems to think I am using a normal account " Client loaded for normal account [MD] with 456 contacts, 76 chats & 95 messages in 30.012s"

Expected Behavior

No response

Steps To Reproduce

await client.sendFile(message.from, link, message.id);

create() code

No response

DEBUG INFO

{
  "WA_VERSION": "2.2208.14",
  "WA_AUTOMATE_VERSION": "4.32.17",
  "BROWSER_VERSION": "HeadlessChrome/100.0.4889.0",
  "START_TS": 1648331934043,
  "LATEST_VERSION": true,
  "CLI": false
}

Environment

- OS: Windows 10
- Node: 16.13.1
- npm: 8.3.0

Screenshots/Logs

C:\Users\User\project\node_modules\puppeteer\lib\cjs\puppeteer\common\ExecutionContext.js:221 throw new Error('Evaluation failed: ' + helper_js_1.helper.getExceptionMessage(exceptionDetails)); ^

Error: Evaluation failed: Error: InvalidMediaFileType at m.sendToChat (https://web.whatsapp.com/bootstrap_qr.7472073f4355d08a7723.js:65:262053) at puppeteer_evaluation_script:1:193251 at async Object.window.. [as sendImage] (puppeteer_evaluation_script:1:189687) at ExecutionContext._evaluateInternal (C:\Users\USER\Desktop\Depot\wa bot\node_modules\puppeteer\lib\cjs\puppeteer\common\ExecutionContext.js:221:19) at runMicrotasks () at processTicksAndRejections (node:internal/process/task_queues:96:5) at async ExecutionContext.evaluate (C:\Users\user\project\node_modules\puppeteer\lib\cjs\puppeteer\common\ExecutionContext.js:110:16)

Anything else?

No response

smashah commented 2 years ago

@shifoc please share the files which is resulting in this error.

Most likely you need to set useChrome: true in your config

shifoc commented 2 years ago

thank you, it worked!