Wa-automate-nodejs: Error: Page Crash Second time

Created on 17 Feb 2020  路  5Comments  路  Source: open-wa/wa-automate-nodejs

Describe the bug

The whatsapp page crashes after some time the phone is either offline or dragging the internet, it might be after a day or some hours.

Steps to Reproduce
Steps to reproduce the behavior:

  1. Run the program, keep it alive for hours and let messages keep flowing in.

After some time, it would result in a page crash.

Error: Page crashed! at Page._onTargetCrashed (/root/api/node_modules/puppeteer/lib/Page.js:216:24) at CDPSession.<anonymous> (/root/api/node_modules/puppeteer/lib/Page.js:124:56) at CDPSession.emit (events.js:321:20) at CDPSession._onMessage (/root/api/node_modules/puppeteer/lib/Connection.js:200:12) at Connection._onMessage (/root/api/node_modules/puppeteer/lib/Connection.js:112:17) at WebSocket.<anonymous> (/root/api/node_modules/puppeteer/lib/WebSocketTransport.js:44:24) at WebSocket.onMessage (/root/api/node_modules/ws/lib/event-target.js:120:16) at WebSocket.emit (events.js:321:20) at Receiver.receiverOnMessage (/root/api/node_modules/ws/lib/websocket.js:789:20) at Receiver.emit (events.js:321:20) at Receiver.dataMessage (/root/api/node_modules/ws/lib/receiver.js:422:14) at Receiver.getData (/root/api/node_modules/ws/lib/receiver.js:352:17) at Receiver.startLoop (/root/api/node_modules/ws/lib/receiver.js:138:22) at Receiver._write (/root/api/node_modules/ws/lib/receiver.js:74:10) at doWrite (_stream_writable.js:454:12) at writeOrBuffer (_stream_writable.js:436:5) at Receiver.Writable.write (_stream_writable.js:327:11) at Socket.socketOnData (/root/api/node_modules/ws/lib/websocket.js:864:35) at Socket.emit (events.js:321:20) at addChunk (_stream_readable.js:297:12) at readableAddChunk (_stream_readable.js:273:9) at Socket.Readable.push (_stream_readable.js:214:10)

create() code
This is the code you use to create the client. e.g

await sulla.create('session', {
      autoRefresh:false
    }).then(client => start(client)).catch(err => console.log(err.message))

Expected behavior

It's going to print errors on the screen/

DEBUG INFO
This is the info printed to the console when you start your app. It should look like this

 Debug Info {
0|index    |   WA_VERSION: '0.4.613',
0|index    |   PAGE_UA: 'WhatsApp/0.4.613 Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36',
0|index    |   SULLA_HOTFIX_VERSION: '1.7.12',
0|index    |   BROWSER_VERSION: 'HeadlessChrome/79.0.3945.0'
0|index    | }

Im using pm2 ,

Screenshots

I can't provide a screenshot because the app is on the server.

Host (please complete the following information):

  • OS: [e.g. iOS] Ubuntu 18.04

Additional context
Add any other context about the problem here.

I tried to give you solutions to solve that here, but seems you weren't interested in it.
https://github.com/smashah/sulla/issues/44#issuecomment-584900412

Most helpful comment

client.page gives access to the puppeteer page on which you can listen to errors using:

client.page.on('error', _=>{
...
}

All 5 comments

My apologies @mrbarnk I was rushing for and on a flight that day. You would want to call client.reload()? Why not just manage this yourself?

client.page gives access to the puppeteer page on which you can listen to errors using:

client.page.on('error', _=>{
...
}

Thanks so much! It's working/

Great @mrbarnk I'll add that to the readme and show an example in demo/index.ts

Was this page helpful?
0 / 5 - 0 ratings

Related issues

blackchineykh picture blackchineykh  路  4Comments

arisros picture arisros  路  4Comments

renato-macedo picture renato-macedo  路  6Comments

vsilva472 picture vsilva472  路  4Comments

scoorpionx picture scoorpionx  路  7Comments