Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sendMp4AsSticker returns ERR_BAD_REQUEST #3254

Open
1 task done
TVARecordings opened this issue Nov 19, 2024 · 0 comments
Open
1 task done

sendMp4AsSticker returns ERR_BAD_REQUEST #3254

TVARecordings opened this issue Nov 19, 2024 · 0 comments

Comments

@TVARecordings
Copy link

Are you using the latest version of the library?

  • I have checked and am 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

I'm receiving this error:

[messageHandler.js] > sendMp4AsSticker Axios: {
"message": "Unsupported protocol e:",
name": "AxiosError",
"stack": "AxiosError: Unsupported protocol e:\n at dispatchHttpRequest (E:\AmecaCore\node_modules\axios\dist\node\axios.cjs:2813:21)\n at E:\AmecaCore\node_modules\axios\dist\node\axios.cjs:2690:5\n at new Promise ()\n at wrapAsync (E:\AmecaCore\node_modules\axios\dist\node\axios.cjs:2670:10)\n at http (E:\AmecaCore\node_modules\axios\dist\node\axios.cjs:2708:10)\n at Axios.dispatchRequest (E:\AmecaCore\node_modules\axios\dist\node\axios.cjs:4135:10)\n at Axios._request (E:\AmecaCore\node_modules\axios\dist\node\axios.cjs:4415:33)\n at Axios.request (E:\AmecaCore\node_modules\axios\dist\node\axios.cjs:4282:25)\n at wrap (E:\AmecaCore\node_modules\axios\dist\node\axios.cjs:28:15)\n at E:\AmecaCore\node_modules\@open-wa\wa-automate\dist\utils\tools.js:173:47\n at Generator.next ()\n at E:\AmecaCore\node_modules\@open-wa\wa-automate\dist\utils\tools.js:31:71\n at new Promise ()\n at __awaiter (E:\AmecaCore\node_modules\@open-wa\wa-automate\dist\utils\tools.js:27:12)\n at getBufferFromUrl (E:\AmecaCore\node_modules\@open-wa\wa-automate\dist\utils\tools.js:170:57)\n at E:\AmecaCore\node_modules\@open-wa\wa-automate\dist\utils\tools.js:193:68\n at Generator.next ()\n at E:\AmecaCore\node_modules\@open-wa\wa-automate\dist\utils\tools.js:31:71\n at new Promise ()\n at __awaiter (E:\AmecaCore\node_modules\@open-wa\wa-automate\dist\utils\tools.js:27:12)\n at getDUrl (E:\AmecaCore\node_modules\@open-wa\wa-automate\dist\utils\tools.js:190:48)\n at Client. (E:\AmecaCore\node_modules\@open-wa\wa-automate\dist\api\Client.js:3719:58)\n at Axios.request (E:\AmecaCore\node_modules\axios\dist\node\axios.cjs:4287:41)\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)",
"config": {
"transitional": {
"silentJSONParsing": true,
"forcedJSONParsing": true,
"clarifyTimeoutError": false
},
"adapter": [
"xhr",
"http",
"fetch"
],
"transformRequest": [
null
],
"transformResponse": [
null
],
"timeout": 0,
"xsrfCookieName": "XSRF-TOKEN",
"xsrfHeaderName": "X-XSRF-TOKEN",
"maxContentLength": -1,
"maxBodyLength": -1,
"env": {},
"headers": {
"Accept": "application/json, text/plain, /",
"DNT": "1",
"Upgrade-Insecure-Requests": "1"
},
"method": "get",
"url": "E:/AmecaCore/media/3A298A972CCFAF62A79A_undefined_1732018804_compressed.mp4",
"responseType": "arraybuffer"
},
"code": "ERR_BAD_REQUEST"
}

Expected Behavior

Expected it to send the mp4 from the filepath as a sticker. The file meets the criterea for stickers.

No matter what file i try as mp4, it errors.

Steps To Reproduce

Code:

case 'save':
        if (isAdmin) {
          const { processMedia } = require('E:/AmecaCore/lib/webpToMP4.js');
          const fs = require('fs-extra'); // Zorg ervoor dat fs-extra is geïmporteerd
          (async () => {
            try {
              const filePath = await processMedia(client, message);
              if (filePath) {
                console.log(`De video is succesvol verwerkt en het bestandspad is: ${filePath}`);
                let result;
                try {
                  const currentDate = new Date();
                  const day = currentDate.getDate().toString().padStart(2, '0');
                  const month = (currentDate.getMonth() + 1).toString().padStart(2, '0');
                  const year = currentDate.getFullYear().toString().slice(-2);
                  console.log(`Case 'sticker' > sendMp4AsSticker(): Attempting to send sticker.`);
                  await client.sendMp4AsSticker(from, filePath, null, null);
                  console.log(colors.greenBright.bold(`S\nU\nC\nC\nC\nE\nS\n!`));
                } catch (error) {
                  console.log(colors.redBright.bold(`E\nR\nR\nO\nR\n!`));
                  console.error(`[messageHandler.js] > sendMp4AsSticker Axios: ${JSON.stringify(error, null, 2)}`);
                  client.sendText(message.from, 'Er is een fout opgetreden bij het verzenden van de sticker.');
                }
              } else {
                console.log('Er is iets misgegaan bij het verwerken van de media.');
                client.sendText(message.from, 'Er is iets misgegaan bij het verwerken van de media.');
              }
            } catch (error) {
              console.error('Fout tijdens het verwerken van de media:', error);
              client.sendText(message.from, 'Er is een fout opgetreden bij het verwerken van de media.');
            }
          })();  // Direct aanroepen van de async functie
        }
        break;

Yes, i'm 100% sure processMedia returns a valid filepath. I've checked the file by checking the DataURL and Base64 string, and both are ok.

Input file (as a example) below.

3A298A972CCFAF62A79A_undefined_1732018804_compressed.mp4

create() code OR full CLI command + CONFIG

No response

DEBUG INFO

{
  "WA_VERSION": "2.3000.1018313257",
  "WA_AUTOMATE_VERSION": "4.74.0 UPDATE AVAILABLE: 4.74.1",
  "BROWSER_VERSION": "Chrome/131.0.6778.70",
  "START_TS": 1732018560562,
  "RAM_INFO": "Total: 68.62 GB | Free: 44.06 GB",
  "PPTR_VERSION": "23.6.0",
  "LATEST_VERSION": false,
  "CLI": false,
  "PATCH_HASH": "CACHED-3aa89",
  "LAUNCH_TIME_MS": 6906,
  "ACC_TYPE": "BUSINESS",
  "chats": 79,
  "messages": 191,
  "contacts": 13198,
  "isBiz": true,
  "isMd": true,
  "INSTANCE_ID": "b7aa1416-ceb2-4f8a-8779-f4a2f83c6d55"
}

Environment

- OS: Windows 10
- Node: 20.17.0
- npm: 10.8.3

Screenshots/Logs

No response

Anything else?

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant