Comments (24)
Hmm, not clear from this error log. Can you try to recreate it by resending the last message that was not received by sulla?
from wa-automate-nodejs.
There is not received message by sulla when the error comes up. I am monitoring on my phone all received message, and I notice the failure because the bot is not responding on an user message. From the last sent message by the bot to the error time there is a difference of 5 hours. The message without response came 8 hours later.
I need that if it fails, at least close the process to restart the container.
from wa-automate-nodejs.
Yea @dogcalas , same here. if it can crash the container and reload it. It would have been awesome.
from wa-automate-nodejs.
I'd love to add the functionality, I just need to be able to reproduce the issue
from wa-automate-nodejs.
Page crashed error, and I think you left a promise un cathed in the code. I think so.
whatsapp_1 | (node:1) 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(). (rejection id: 10) whatsapp_1 | (node:1) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
from wa-automate-nodejs.
Maybe there will be a watcher to let you know if the page has crashed. @smashah
I don't know any solution after that.
from wa-automate-nodejs.
Possibly this ? puppeteer/puppeteer#1030
from wa-automate-nodejs.
maybe so.
from wa-automate-nodejs.
@smashah you can check this out. https://stackoverflow.com/questions/57956697/unhandledpromiserejectionwarning-error-page-crashed-while-using-puppeteer
from wa-automate-nodejs.
@mrbarnk can you share your code so I can figure out how to reproduce this.
from wa-automate-nodejs.
I read your best practice, and I've tried adding await to all my codes now, let see how this goes.
Thanks @smashah
from wa-automate-nodejs.
@mrbarnk @dogcalas in v =1.6.6 you can now use client.kill()
This way you can control when a session is destroyed upon catch statements
e.g
...
try{
...
await client.sendMessage(...
...
} catch(error){
client.kill();
//maybe restart the session then
}
Hope that works for you. I'll close this for now. thanks
from wa-automate-nodejs.
Before write this issue all my awaits calls was between try-catch. Although, I still receiving this error, and never a catch section is executed. After 5 days without problems, boom, it happened again. Most weird is that the trace doesn't show any sulla files.
Just to know, what nodejs version are you using? I am using node:10-slim docker image.
@mrbarnk are you using WebSockets to do others things in your code?
from wa-automate-nodejs.
from wa-automate-nodejs.
From the error code, you can see that this error is happening onMessage
so maybe you should try something like:
try{
client.onMessage(message=>{...})
} catch(error){
client.kill();
//maybe restart the session then
}
from wa-automate-nodejs.
I'm using client.sendText()
.
Please, guide me on this you posted.
from wa-automate-nodejs.
And again on the latest version, please set auto-refresh QR code to option.
So, we that do not need it will not be affected, sir.
Thanks!
from wa-automate-nodejs.
@mrbarnk in v1.6.10 you can now set autoRefresh:false
when you start sulla.
https://github.com/smashah/sulla/blob/629f75969416cc4cf6c58cf45b004db1c9240e49/demo/index.ts#L108
from wa-automate-nodejs.
@smashah Today in the morning I received the same error, and sulla stop receiving messages. The only reason I can figure out, is a today change in whatsapp version.
I have noticed in my web browser when whatsapp is updated, this messages comes up.
Could this be the issue cause?
from wa-automate-nodejs.
@dogcalas possibly. Over the last 2 days they released version 0.4.613. Is it ok when u restart?
from wa-automate-nodejs.
Yes, it's ok, when I restart everything is working normally.
from wa-automate-nodejs.
When you run the sulla-hotfix on a server, after some hours or days, it goes crash! I don't seem to understand that.
and I think this is the possible fix for the problem sir.
from wa-automate-nodejs.
Or from the whatsapp.ts or initializer.ts, whichever one what works, the class should have a method that kills the session and restarts it automatically.
In whatsapp.ts
public async reload() {
console.log('Restarting node');
if (this.page) await this.kill();
// to recreate the sessionw when session get killed.
await this.create(globalSession,globalpuppeteerConfigOverride,globalcustomUserAgent)
return true;
In initialize.ts
public async reload() {
console.log('Restarting node');
await waPage.close();
await waPage.browser().close();
Then the globalSession
, globalpuppeteerConfigOverride
and globalcustomUserAgent
would have been stored when the create function was initaly initialized by us.
So like export async function create
would be changed to
let globalSession,globalpuppeteerConfigOverride,globalcustomUserAgent;
export async function create(sessionId?: string, puppeteerConfigOverride?:any, customUserAgent?:string) {
if (!sessionId) sessionId = 'session';
globalSession = sessionId
globalpuppeteerConfigOverride = puppeteerConfigOverride
globalcustomUserAgent = customUserAgent
I think with this, the problem should be solved @smashah
from wa-automate-nodejs.
I saw something now,
like you have it in create function,
spinner.fail('The session is invalid. Retrying')
await kill()
return await create(sessionId,puppeteerConfigOverride,customUserAgent);
You can just implement this in the public async reload() function which we just want to create to reload the session when page drops.
Those are three possible solutions I can give you for now.
from wa-automate-nodejs.
Related Issues (20)
- When QR Code is Scanned, a new QR with 'undefined' is generated
- ProtocolError: Protocol error (Runtime.callFunctionOn): Promise was collected
- sendImageAsSticker() returns: TypeError: ((intermediate value)(intermediate value)(intermediate value) || (intermediate value)(intermediate value)(intermediate value)).replace is not a function HOT 4
- sendMp4AsSticker() not responding. HOT 4
- leaveGroup broken HOT 1
- Error during health check evaluation HOT 8
- Documentation still broken. HOT 2
- API Error: Unable to Post Poll Due to Incorrect Argument Parsing HOT 3
- QRcode does not start
- App dies after the first message HOT 1
- Incoming message doesn’t work HOT 1
- Isnt Replying HOT 3
- Does not receive messages or send my bot HOT 5
- A way to get the raw message from the Websocket
- `onLibraryUpdate`
- Session survives only 4 to 5 container restarts.
- stickerUrl.replace is not a function HOT 6
- fallback gh url should have `?t=123456....` to force a cache clear
- authentication freezing on launch HOT 3
- fix healthCheck HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wa-automate-nodejs.