-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Fix context destroyed on client initialize #3531
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
base: main
Are you sure you want to change the base?
Fix context destroyed on client initialize #3531
Conversation
|
have you @aleborile been able to run wa-app in a stable way with this version? Or only tested it a bit locally? we are suffering from similar "execution context destroyed" problems but I am not 100% sure at what point they exactly occur. |
|
I tested locally and on production for couple of weeks without any problem since release. |
|
Please, only change the code you are supose to fix, revert all other changes. |
affcb0a to
8d5a60f
Compare
|
im sorry, now i kept only the main fix described by this pr. the second commit its just formatting |
|
I frequently encounter this issue (Fix context destroyed). Incorporating this PR would be highly beneficial, as it always occurs unexpectedly. |
d5d72ef to
8d5a60f
Compare
8d5a60f to
92a5010
Compare
|
Did someone try the PR? |
…ext-destroyed-on-initialize
PR Details
Catch errors during intialization ONLY if page reloading events occours
Description
in
Client.initialize()function an handler offramenavigatedevent is created to track that a page reloading is ongoing and context can be destroyed in any moment. If some error happens due toframenavigatedthe flow can return normally because anotherClient.initialize()are going to be re-executed (Client.js:339)Related Issue(s)
closes #2056
Motivation and Context
The change is required to handle errors from context destroyed correclty during initialization without killing the process if unpredictable (by Meta) refresh happens.
Error raised on reloading when initialization is in progress:
at rewriteError (/usr/src/app/node_modules/puppeteer-core/lib/cjs/puppeteer/common/ExecutionContext.js:284:15) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async ExecutionContext._ExecutionContext_evaluate (/usr/src/app/node_modules/puppeteer-core/lib/cjs/puppeteer/common/ExecutionContext.js:227:56) at async ExecutionContext.evaluate (/usr/src/app/node_modules/puppeteer-core/lib/cjs/puppeteer/common/ExecutionContext.js:107:16) at async Client.getWWebVersion (/usr/src/app/node_modules/whatsapp-web.js/src/Client.js:811:16) at async Client.inject (/usr/src/app/node_modules/whatsapp-web.js/src/Client.js:98:25) at async Client.initialize (/usr/src/app/node_modules/whatsapp-web.js/src/Client.js:329:9)How Has This Been Tested
My clients in production never crash anymore during initialization and connect correctrly at first run.
Environment
Types of changes
Checklist