-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Client authentication doesn't work in packaged electron app #1855
Comments
Whatsapp authentication doesn't work |
Is there any update on this? |
Whatsapp-web.js has native-dependencies, handle accordingly. |
@piedpie did you figure it out ? I have the same issue |
@Minenat69 as mentioned by @dev-javid WhatsApp web js seems to have some native module dependency so make sure you are taking care of same. |
Is there an existing issue for this?
Describe the bug
UnhandledPromiseRejectionWarning: Error: Evaluation failed: ReferenceError: t is not defined at moduleRaid
Electron app when packaged doesn't seem to work.
Initially I was getting this error:
(node:4288) UnhandledPromiseRejectionWarning: Error: Could not find expected browser (chrome) locally. Run
npm installto download the correct Chromium revision (982053). at y.launch (C:\Users\admin\AppData\Local\Programs\sample-whatsapp\resources\app.asar\dist\main\webpack:\node_modules\puppeteer\lib\cjs\puppeteer\node\Launcher.js:105:23) at launch (C:\Users\admin\AppData\Local\Programs\sample-whatsapp\resources\app.asar\dist\main\webpack:\node_modules\puppeteer\lib\cjs\puppeteer\node\Puppeteer.js:125:31) at e.exports.initialize (C:\Users\admin\AppData\Local\Programs\sample-whatsapp\resources\app.asar\dist\main\webpack:\node_modules\whatsapp-web.js\src\Client.js:100:39) at processTicksAndRejections (node:internal/process/task_queues:96:5)
Then I changed puppeteer options to set executable path to my google chrome exe like following:
Now we when we run the packaged application we get the
qr
code,qr
event is being fired succcessfully.But after scanning the qr code
authenticated
orready
events are never fired.No other events like
auth_failure
ordisconnected
are either fired.In this case when debugging the installed app I have seen the following error in logs:
(node:13604) UnhandledPromiseRejectionWarning: Error: Evaluation failed: ReferenceError: t is not defined at moduleRaid (eval at <anonymous> (:1:18), <anonymous>:1:29) at __puppeteer_evaluation_script__:1:68 at t.ExecutionContext._evaluateInternal (C:\Users\admin\AppData\Local\Programs\sample-whatsapp\resources\app.asar\dist\main\webpack:\node_modules\puppeteer\lib\cjs\puppeteer\common\ExecutionContext.js:221:19) at processTicksAndRejections (node:internal/process/task_queues:96:5) at t.ExecutionContext.evaluate (C:\Users\admin\AppData\Local\Programs\sample-whatsapp\resources\app.asar\dist\main\webpack:\node_modules\puppeteer\lib\cjs\puppeteer\common\ExecutionContext.js:110:9) at e.exports.initialize (C:\Users\admin\AppData\Local\Programs\sample-whatsapp\resources\app.asar\dist\main\webpack:\node_modules\whatsapp-web.js\src\Client.js:265:9) (node:13604) 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: 2)
This is happening on windows machine. I haven't tried on mac or linux.
I have created a sample repository on github, in case you want to see the code. Link is here.
It is a very simple app where we can scan the qr code and it prints the
client
events in the UI with the time.Expected behavior
After scanning the qr code
authenticated
andready
events should be fired.And we should be able to send and receive messages.
Steps to Reproduce the Bug or Issue
Clone the sample repo https://github.com/piedpie/sample-whatsapp
Package the app
npm run package
From
release/build
folder install the application.Launch the installed app.
Additionally use debugtron to debug the installed app.
Relevant Code
No response
Browser Type
Google Chrome
WhatsApp Account Type
Standard
Does your WhatsApp account have multidevice enabled?
Yes, I am using Multi Device
Environment
OS: Windows 10
Phone OS: Android
whatsapp-web.js version: 1.18.4
WhatsApp Web version : 2.2245.9
Node.js Version: v18.12.0
Additional context
I have tested with both normal and business accounts.
The text was updated successfully, but these errors were encountered: