pedroslopez / whatsapp-web.js

A WhatsApp client library for NodeJS that connects through the WhatsApp Web browser app
https://wwebjs.dev
Apache License 2.0
14.53k stars 3.46k forks source link

.mp4 unable to send from today on 2.2412.54 #3002

Closed momokang closed 2 months ago

momokang commented 2 months ago

Is there an existing issue for this?

Describe the bug

Until yesterday it was fine and today it suddenly cannot send mp4 and it hangs there, I wonder why no bug report.

Expected behavior

  1. Send .mp4 video
  2. Send video in WhatsApp

Steps to Reproduce the Bug or Issue

  1. Send .mp4 video
  2. Send video in WhatsApp
  3. It just hand there without any response

Relevant Code

var executablePath = '/usr/bin/google-chrome-stable'; client = new Client({ authStrategy: new LocalAuth({ clientId: 'session' + whatsappId, dataPath: './tokens/session' + whatsappId }), puppeteer: { args: [ '--no-sandbox', '--disable-setuid-sandbox', '--disable-gpu-driver-bug-workarounds', '--disable-accelerated-2d-canvas', ], ignoreDefaultArgs: ['--disable-dev-shm-usage'], ignoreHTTPSErrors: true, executablePath: executablePath, // headless: false, }, webVersionCache: { type: 'remote', remotePath: 'https://raw.githubusercontent.com/wppconnect-team/wa-version/main/html/2.2410.1.html', // Tried 2.2412.54 still same result } });

const media = await MessageMedia.fromUrl(attachment_url); await client.sendMessage( customerPhone, media )

Browser Type

Chromium

WhatsApp Account Type

Standard

Does your WhatsApp account have multidevice enabled?

Yes, I am using Multi Device

Environment

OS: Windows Phone OS: Android whatsapp-web.js version 1.23.1-alpha.3 WhatsApp Web version [run await client.getWWebVersion()]: Node.js Version 20.11

Additional context

Current workaround is I set sendMediaAsDocument = true, but it's not right as customer don't like to see document.

Jessicagsz commented 2 months ago

Same here!

JohnnyLove777 commented 2 months ago

Same here but for Ubuntu!

Probably is something about Google Chrome, here my log output:

1|typeList | Error: Failed to launch the browser process! spawn /usr/bin/google-chrome-stable ENOENT 1|typeList | 1|typeList | 1|typeList | TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md 1|typeList | 1|typeList | at onClose (/root/typezap-classic-dash/node_modules/whatsapp-web.js/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:241:20) 1|typeList | at ChildProcess. (/root/typezap-classic-dash/node_modules/whatsapp-web.js/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:233:85) 1|typeList | at ChildProcess.emit (node:events:517:28) 1|typeList | at ChildProcess._handle.onexit (node:internal/child_process:290:12) 1|typeList | at onErrorNT (node:internal/child_process:477:16) 1|typeList | at process.processTicksAndRejections (node:internal/process/task_queues:82:21)

themazim commented 2 months ago

Same issue here. It seems processing videos in 2.24xx versions no longer works. I tried to send a video manually (not through wwebjs) and this was not possible too.

From what I found, the underlying worker is not returning the processed file after calling processRawMedia. Not sure if this is actually related to WhatsApp not allowing media processing (videos) in 2.24xx.

JohnnyLove777 commented 2 months ago

Alright, try to run

sudo apt-get install libasound2t64

Seems libasound2 is not avaible anymore

After reinstall Google Chrome if needed

Worked for me, running at Ubuntu

themazim commented 2 months ago

Alright, try to run

sudo apt-get install libasound2t64

Seems libasound2 is not avaible anymore

After reinstall Google Chrome if needed

Worked for me, running at Ubuntu

is sending videos working for you again?

themazim commented 2 months ago

Same here but for Ubuntu!

Probably is something about Google Chrome, here my log output:

1|typeList | Error: Failed to launch the browser process! spawn /usr/bin/google-chrome-stable ENOENT 1|typeList | 1|typeList | 1|typeList | TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md 1|typeList | 1|typeList | at onClose (/root/typezap-classic-dash/node_modules/whatsapp-web.js/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:241:20) 1|typeList | at ChildProcess. (/root/typezap-classic-dash/node_modules/whatsapp-web.js/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:233:85) 1|typeList | at ChildProcess.emit (node:events:517:28) 1|typeList | at ChildProcess._handle.onexit (node:internal/child_process:290:12) 1|typeList | at onErrorNT (node:internal/child_process:477:16) 1|typeList | at process.processTicksAndRejections (node:internal/process/task_queues:82:21)

This does not seem to be related to the actual issue with sending videos. There is no error thrown, just a infinite await for processing the video.

JohnnyLove777 commented 2 months ago

Alright, try to run sudo apt-get install libasound2t64 Seems libasound2 is not avaible anymore After reinstall Google Chrome if needed Worked for me, running at Ubuntu

is sending videos working for you again?

Yes! After replacing libasound2 by libasound2t64 and reinstalling Google Chrome, vids are back

JohnnyLove777 commented 2 months ago

Okie dokie, they are back only for Exodus 👯

themazim commented 2 months ago

Okie dokie, they are back only for Exodus 👯

Yeah, 2.24xx still not working for me on ubuntu after reinstalling chrome and libasound2t64

YonatanZviLevy commented 2 months ago

It also stopped working for me in the last 12 hours Will a format other than mp4 solve the problem

themazim commented 2 months ago

It also stopped working for me in the last 12 hours Will a format other than mp4 solve the problem

I tried multiple formats (.mov, .avi, .mp4) and none of them worked.

YonatanZviLevy commented 2 months ago

It works for me I upgraded to node 18.XX.X windows 10

themazim commented 2 months ago

Still not working for me on any system with 2.24xx:

Node v18.17.1 (LTS) Google Chrome 124.0.6367.60 Ubuntu 20.04.6 LTS

and:

Node v18.20.2 (LTS) Google Chrome 124.0.6367.118 Ubuntu 22.04.4 LTS

PurpShell commented 2 months ago

working on this

erickmourasilva commented 2 months ago

libasound2t64

This package doesn't exist in Ubuntu 20.04

douglascaurismo commented 2 months ago

Not just on Ubuntu. Sending videos using Chrome on Windows is also not working. On Windows I upgrade to Node.js 20. Client Version 2.24xxx using chromeless false and manually upload videos also seems to be not working. On version 2.30xxx webpack exodus it works manually but not via api. There is a file .wasm, possibly responsable for video processing, that never loads.

kingmagatron commented 2 months ago

hi. I don't know about the WhatsApp web client version but as observed, same browser same OS loads new WhatsApp web version (which is good in sending videos manually) when opened directly but loads a specific old version (which can not send even manually) when loads using the script.

I have change may browsers Chrome, Chromium, Opera, Edge and the user-Agents but failed to load new WhatsApp web version using script.

If we somehow move to newer version the issue may be resolved.

guigo613 commented 2 months ago

Yes, probably, but it would be a lot of work for the folks who update this repository.

I haven't looked at the codebase, nor how extensive the most recent versions of WhatsApp Web have been, but from what little I've noticed, there's been a change that will likely require a lot of effort to update everything, and for that, we need people with free time to work on it.

With some changes in the file from one version, I managed to send the videos; however, I'm still testing. I'm editing version 2.2413.51

I don't think it's the best solution, but I'm looking for something quick for now. If everything goes well, I'll bring news.

kingmagatron commented 2 months ago

2.2413.51

Great.

themazim commented 2 months ago

Yes, probably, but it would be a lot of work for the folks who update this repository.

I haven't looked at the codebase, nor how extensive the most recent versions of WhatsApp Web have been, but from what little I've noticed, there's been a change that will likely require a lot of effort to update everything, and for that, we need people with free time to work on it.

With some changes in the file from one version, I managed to send the videos; however, I'm still testing. I'm editing version 2.2413.51

I don't think it's the best solution, but I'm looking for something quick for now. If everything goes well, I'll bring news.

Out of curiosity: What is your approach?

guigo613 commented 2 months ago

Yes, probably, but it would be a lot of work for the folks who update this repository. I haven't looked at the codebase, nor how extensive the most recent versions of WhatsApp Web have been, but from what little I've noticed, there's been a change that will likely require a lot of effort to update everything, and for that, we need people with free time to work on it. With some changes in the file from one version, I managed to send the videos; however, I'm still testing. I'm editing version 2.2413.51 I don't think it's the best solution, but I'm looking for something quick for now. If everything goes well, I'll bring news.

Out of curiosity: What is your approach?

The versions we have saved pull other JS files, from what I understand there were changes in those files.

Unfortunately, I don't have access to the original content to verify if there really were changes, but upon checking, I tried updating some content and implementing it directly in the HTML instead of pulling from their repository, and with that, I was able to make changes to it and test.

It's tricky to work with because everything is minified, but I found where it's getting stuck, and with a small change, I managed to send the videos.

However, I did the tests using the browser directly without using headless mode and had a good result, but I haven't had time yet to test directly through the bot using headless mode.

PS: The test I currently performed was running the project with the options: "devtools: true, headless: false" and directly through the open browser and monitoring the changes, now I will test without using these tools. image

guigo613 commented 2 months ago

I managed to get the videos to be sent. I don't believe it's the best solution, as I think it would be better to update the entire API to work with the latest versions. However, I have something that could help everyone who needs a solution at this time.

Unfortunately, I don't think this solution is something to solve the issue of this post since it's not within the project scope and it was a change in the files of the WhatsApp page.

So I'm not sure where I can post this change and what the best place to share it is. It was more work than I thought, I guess I lost some sleep over it, haha.

If anyone can help me by advising how I should be sharing this, I would greatly appreciate it.

If anyone can help me figure out how I should be sharing this, especially considering that the issue lies with the static files pulled by the web

douglascaurismo commented 2 months ago

If anyone can help me figure out how I should be sharing this, especially considering that the issue lies with the static files pulled by the web

@guigo613 Perhaps you can publish your files in this project https://github.com/wppconnect-team/wa-version/tree/main/html and a link to it here.

It seems you can attach files directly here too

guigo613 commented 2 months ago

I've added the file to a repository and I'll be leaving the link here for anyone who needs a solution for this moment while the API doesn't work with the latest versions of WhatsApp.

alternative-wa-version repository

kingmagatron commented 2 months ago

Hi. bundle of thanks bro for all this help.

FOR ME IT IS WORKING FINE with OPERA browser using below.

const client = new Client({
    webVersion: "2.2412.54v2",
    webVersionCache: {
        type: "remote",
        remotePath:"https://raw.githubusercontent.com/guigo613/alternative-wa-version/main/html/2.2412.54v2.html"
    },
    puppeteer: {
        headless: false,
        executablePath: "C:\\Program Files\\Opera\\109.0.5097.68\\opera.exe"
    }
});

I do not have chrome to test right now but on puppeteer default Chromium it crashes with

node_modules\puppeteer-core\lib\cjs\puppeteer\common\ExecutionContext.js:229 throw new Error('Evaluation failed: ' + (0, util_js_1.getExceptionMessage)(exceptionDetails)); ^

Error: Evaluation failed: N at ExecutionContext._ExecutionContext_evaluate (node_modules\puppeteer-core\lib\cjs\puppeteer\common\ExecutionContext.js:229:15) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async ExecutionContext.evaluate (node_modules\puppeteer-core\lib\cjs\puppeteer\common\ExecutionContext.js:107:16) at async Client.sendMessage (whatsapp-web.js\src\Client.js:998:28)

Node.js v20.12.2

In addition

Chromium does not load thumbnails when open the chat in the browser and says "this video not supported" if try to send manually.

a humble request is that please keep this version and generate a new file with fixes if u move forward on this.

thanks again.

guigo613 commented 2 months ago

Hi. bundle of thanks bro for all this help.

FOR ME IT IS WORKING FINE with OPERA browser using below.

const client = new Client({ webVersion: "2.2412.54v2", webVersionCache: { type: "remote", remotePath:"https://raw.githubusercontent.com/guigo613/alternative-wa-version/main/html/2.2412.54v2.html" }, puppeteer: { headless: false, executablePath: "C:\Program Files\Opera\109.0.5097.68\opera.exe" } });

I do not have chrome to test right now but on puppeteer default Chromium it crashes with

node_modules\puppeteer-core\lib\cjs\puppeteer\common\ExecutionContext.js:229 throw new Error('Evaluation failed: ' + (0, util_js_1.getExceptionMessage)(exceptionDetails)); ^

Error: Evaluation failed: N at ExecutionContext._ExecutionContext_evaluate (node_modules\puppeteer-core\lib\cjs\puppeteer\common\ExecutionContext.js:229:15) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async ExecutionContext.evaluate (node_modules\puppeteer-core\lib\cjs\puppeteer\common\ExecutionContext.js:107:16) at async Client.sendMessage (whatsapp-web.js\src\Client.js:998:28)

Node.js v20.12.2

a humble request is that please keep this version and generate a new file with fixes if u move forward on this.

thanks again.

In my tests, I did everything in Chrome.

const client = new Client({
    webVersion: "2.2412.54v2",
    puppeteer: {
        executablePath: 'C:/Program Files/Google/Chrome/Application/chrome.exe'
    }
});
kingmagatron commented 2 months ago

Hi. bundle of thanks bro for all this help. FOR ME IT IS WORKING FINE with OPERA browser using below. const client = new Client({ webVersion: "2.2412.54v2", webVersionCache: { type: "remote", remotePath:"https://raw.githubusercontent.com/guigo613/alternative-wa-version/main/html/2.2412.54v2.html" }, puppeteer: { headless: false, executablePath: "C:\Program Files\Opera\109.0.5097.68\opera.exe" } }); I do not have chrome to test right now but on puppeteer default Chromium it crashes with node_modules\puppeteer-core\lib\cjs\puppeteer\common\ExecutionContext.js:229 throw new Error('Evaluation failed: ' + (0, util_js_1.getExceptionMessage)(exceptionDetails)); ^ Error: Evaluation failed: N at ExecutionContext._ExecutionContext_evaluate (node_modules\puppeteer-core\lib\cjs\puppeteer\common\ExecutionContext.js:229:15) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async ExecutionContext.evaluate (node_modules\puppeteer-core\lib\cjs\puppeteer\common\ExecutionContext.js:107:16) at async Client.sendMessage (whatsapp-web.js\src\Client.js:998:28) Node.js v20.12.2 a humble request is that please keep this version and generate a new file with fixes if u move forward on this. thanks again.

In my tests, I did everything in Chrome.

const client = new Client({
    webVersion: "2.2412.54v2",
    puppeteer: {
        executablePath: 'C:/Program Files/Google/Chrome/Application/chrome.exe'
    }
});

Great. It seems we are good to go with this. (Y)

themazim commented 2 months ago

I've added the file to a repository and I'll be leaving the link here for anyone who needs a solution for this moment while the API doesn't work with the latest versions of WhatsApp.

alternative-wa-version repository

Tested this quickly locally. Works for me.

Tested with Google Chrome & Ubuntu. No changes to google chrome or libaudio required.

themazim commented 2 months ago

I've added the file to a repository and I'll be leaving the link here for anyone who needs a solution for this moment while the API doesn't work with the latest versions of WhatsApp.

alternative-wa-version repository

Any chance you can do this for "2.2413.51-beta" too or let me know what and how you did so we can port ourselves?

guigo613 commented 2 months ago

Yes, I added it there, except for the fact that the two versions have differences, the change is the same. Unfortunately, I can't test it at the moment, so if anyone could confirm if everything is okay, I'd be happy.

The issue lies in a single WhatsApp JavaScript file. I believe they modified this file and left the flaw. However, this file apparently is not used anymore in the latest versions, so I don't know the reason or if they really modified it.

What I did was modify it to have the expected behavior. I didn't want to delve too deep to check all the behavior because it would be too much work, so I changed only what was necessary.

I noticed that they pull a wasm file with a different name in the latest versions, so to prevent the file from becoming unavailable for any reason, I took the liberty of adding its bytes to the code as well.

In summary, the issue was with the code expecting the initialization of the wasm file, and the code is not handling it correctly.

themazim commented 2 months ago

Yes, I added it there, except for the fact that the two versions have differences, the change is the same. Unfortunately, I can't test it at the moment, so if anyone could confirm if everything is okay, I'd be happy.

The issue lies in a single WhatsApp JavaScript file. I believe they modified this file and left the flaw. However, this file apparently is not used anymore in the latest versions, so I don't know the reason or if they really modified it.

What I did was modify it to have the expected behavior. I didn't want to delve too deep to check all the behavior because it would be too much work, so I changed only what was necessary.

I noticed that they pull a wasm file with a different name in the latest versions, so to prevent the file from becoming unavailable for any reason, I took the liberty of adding its bytes to the code as well.

In summary, the issue was with the code expecting the initialization of the wasm file, and the code is not handling it correctly.

Tested this locally, with both versions and both version work fine now. Thank you so much!

please enjoy a coffee on my behalf :)

samanushuke commented 2 months ago
const client = new Client({
    webVersion: "2.2412.54v2",
    puppeteer: {
        executablePath: 'C:/Program Files/Google/Chrome/Application/chrome.exe'
    }
});

Thank you i am using this configuration and so far working fine on google chrome

const client = new Client({ 
     webVersion: "2.2412.54v2",
    authStrategy: new LocalAuth({
      dataPath: "sessions",
      }),
      webVersionCache: {
      type: 'remote',
      remotePath: 'https://raw.githubusercontent.com/guigo613/alternative-wa-version/main/html/2.2412.54v2.html',
      },
    restartOnAuthFail: true,
    puppeteer: { 
            executablePath: 'C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe',
        },
    });

@whatsapp-web.js v 1.23.0

momokang commented 2 months ago

Hello, thanks for the fix, I tested on 2.2412.54v2 by just changing the remotePath to https://raw.githubusercontent.com/guigo613/alternative-wa-version/main/html/2.2412.54v2.html it will fix it,

but unfortunately it will regenerate the QR code to scan.. is that any other way just to update version without regenerate QR code?

themazim commented 2 months ago

Hello, thanks for the fix, I tested on 2.2412.54v2 by just changing the remotePath to https://raw.githubusercontent.com/guigo613/alternative-wa-version/main/html/2.2412.54v2.html it will fix it,

but unfortunately it will regenerate the QR code to scan.. is that any other way just to update version without regenerate QR code?

Which Version were you running before? if you were using a higher version like 2.2413.51 use this link instead:

https://raw.githubusercontent.com/guigo613/alternative-wa-version/main/html/2.2413.51-beta-alt.html

momokang commented 2 months ago

Hello, thanks for the fix, I tested on 2.2412.54v2 by just changing the remotePath to https://raw.githubusercontent.com/guigo613/alternative-wa-version/main/html/2.2412.54v2.html it will fix it, but unfortunately it will regenerate the QR code to scan.. is that any other way just to update version without regenerate QR code?

Which Version were you running before? if you were using a higher version like 2.2413.51 use this link instead:

https://raw.githubusercontent.com/guigo613/alternative-wa-version/main/html/2.2413.51-beta-alt.html

I'm using lower version https://raw.githubusercontent.com/wppconnect-team/wa-version/main/html/2.2410.1.html

Let me test more on other version see if the session break

guigo613 commented 2 months ago

I did the same in version 2.2410.1 to see if it helps you. If you can test and tell me if it's working.

https://raw.githubusercontent.com/guigo613/alternative-wa-version/main/html/2.2410.1.html

momokang commented 2 months ago

I did the same in version 2.2410.1 to see if it helps you. If you can test and tell me if it's working.

https://raw.githubusercontent.com/guigo613/alternative-wa-version/main/html/2.2410.1.html

It works like a charm now ! Thanks a lot!