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 589 forks source link

Error sendRawWebpAsSticker #2633

Closed dandyraka closed 2 years ago

dandyraka 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

Found error when I try this webp here. I don't know why.

Expected Behavior

send webp sticker normally

Steps To Reproduce

run the script

create() code

No response

DEBUG INFO

{
  "WA_VERSION": "2.2210.9",
  "WA_AUTOMATE_VERSION": "4.33.3 UPDATE AVAILABLE: 4.33.4",
  "BROWSER_VERSION": "HeadlessChrome/99.0.4844.84",
  "START_TS": 1649354097511,
  "LATEST_VERSION": false,
  "CLI": false,
  "LAUNCH_TIME_MS": 24121,
  "ACC_TYPE": "BUSINESS",
  "chats": 34,
  "messages": 50,
  "contacts": 1153,
  "isBiz": true,
  "isMd": true,
  "INSTANCE_ID": "880376eb-5336-437f-89eb-6bc8aa47b489"
}

Environment

- OS: Windows 10
- Node: 16.13.2
- npm: 8.2.0

Screenshots/Logs

image

Error: Evaluation failed: a at ExecutionContext._evaluateInternal (C:\laragon\www\wabot\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:\laragon\www\wabot\node_modules\puppeteer\lib\cjs\puppeteer\common\ExecutionContext.js:110:16)

Anything else?

No response

dandyraka commented 2 years ago

Update:

Maybe because filesize. The original webp is 1MB, when I try to optimize using ezgif.com here and the filesize become 615KB it work no error.

smashah commented 2 years ago

I think this is due to the encoding of the file?

it comes up as a data:image/octet-stream;. I'll try to carve out some sort of workaround for this in the meantime. But yeah, best to keep stickers under 1mb. Do some compression. Also, sendImageAsSticker does this for you even on webp files - it also encodes the image properly.

smashah commented 2 years ago

@github-actions run

⚡ Release! ⚡ ```js (async () => { function exec(cmd) { console.log(execSync(cmd).toString()); } //set the version type process.env.VERS = "patch" // Config const gitUserEmail = "github-actions[bot]@users.noreply.github.com"; const gitUserName = "github-actions[bot]"; exec(`echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc`); exec(`git config --global user.email "${gitUserEmail}"`); exec(`git config --global user.name "${gitUserName}"`); exec(`npm i -D`); exec(`npm run release-ci $VERS`); // types only package exec('npm config set //registry.npmjs.org/:_authToken $NPM_TOKEN') exec(`cd ./types-only && npm version $VERS && npm run build && npm publish && cd ..`); exec(`git commit -a -m 'updated types-only package'`); exec(`git push --force`); //comment on the issue var result = execSync(`npx auto-changelog -o ./tempchangelog.txt --commit-limit false --template ./compact-keepachangelog.hbs --stdout`).toString(); await postComment(result); //create changelog image exec(`npm run release-image`); exec(`git commit -a -m 'updated release-image'`); exec(`git push --force`); })(); ```
smashah commented 2 years ago

Changelog

🚀 Release 4.33.6 (2022-04-08)

dandyraka commented 2 years ago

@smashah

Still same error (open-wa v4.33.7), I check the mimetype is image/webp image

and when I use sendImageAsSticker show error like this, maybe because it's animated webp. image

How to compress animated webp?

dandyraka commented 2 years ago

I test like this, send as document not image image

dandyraka commented 2 years ago

Solved using sharp image