raweee / node-red-contrib-whatsapp-link

Simple Node-Red node to link Whatsapp
https://discord.gg/VApVeGuF
26 stars 7 forks source link

can´t generate QR code #6

Closed Tsamsiyu1 closed 1 year ago

Tsamsiyu1 commented 1 year ago

hi its me again^^ i try and try but i can´t generate a QR code. in nodered it stays on Connecting... and in the terminal it says this:

0|node-red`  | TypeError: Cannot read properties of null (reading 'close')
0|node-red  |     at Client.destroy (/home/marcel/.node-red/node_modules/whatsapp-web.js/src/Client.js:569:31)
0|node-red  |     at WhatsappAdmin.WARestart (/home/marcel/.node-red/node_modules/node-red-contrib-whatsapp-link/whatsappLink.js:100:26)
0|node-red  |     at WhatsappAdmin._inputCallback (/home/marcel/.node-red/node_modules/node-red-contrib-whatsapp-link/admin.js:33:22)
0|node-red  |     at /home/marcel/.nvm/versions/node/v17.6.0/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/nodes/Node.js:210:26
0|node-red  |     at Object.trigger (/home/marcel/.nvm/versions/node/v17.6.0/lib/node_modules/node-red/node_modules/@node-red/util/lib/hooks.js:166:13)
0|node-red  |     at WhatsappAdmin.Node._emitInput (/home/marcel/.nvm/versions/node/v17.6.0/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/nodes/Node.js:202:11)
0|node-red  |     at WhatsappAdmin.Node.emit (/home/marcel/.nvm/versions/node/v17.6.0/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/nodes/Node.js:186:25)
0|node-red  |     at WhatsappAdmin.Node.receive (/home/marcel/.nvm/versions/node/v17.6.0/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/nodes/Node.js:485:10)
0|node-red  |     at Immediate.<anonymous> (/home/marcel/.nvm/versions/node/v17.6.0/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/flows/Flow.js:831:52)
0|node-red  |     at processImmediate (node:internal/timers:466:21)
0|node-red  | 10 Jan 17:11:01 - [info] [whatsappLink:Web] Error : Connection is slow...
0|node-red  | 10 Jan 17:11:11 - [info] [whatsappLink:Web] Error : Connection is slow...

I´m just sending the string restart in msg.payload.

raweee commented 1 year ago

Can not read property of null, means Whatsapp Client is not even initialise yet (client is null). Try to restart complete flow or complete node-red once if possible.

Till I'll see what change require in code to solve the problem.

Tsamsiyu1 commented 1 year ago

this is right after a restart of node red. I can´t initialize a whatsapp client at all.

I have this running on a linux server (without gui) within PM2.

raweee commented 1 year ago

Hi, Simply restart of node-red will work, that problem was occur due to delay in connecting with whatsapp. Please wait after restart (at QR stage).

Using restart command multiple time crashes the whatsapp-node. It is fixed but not perfectly :smile: working on it :+1:

Tsamsiyu1 commented 1 year ago

ok i will try this now

Tsamsiyu1 commented 1 year ago

Ok this is still not working but i get an other error now.

Error: Failed to launch the browser process! 0|node-red | /home/marcel/.node-red/node_modules/puppeteer/.local-chromium/linux-982053/chrome-linux/chrome: error while loading shared libraries: libatk-1.0.so.0: cannot open shared object file: No such file or directory 0|node-red | TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md 0|node-red | at onClose (/home/marcel/.node-red/node_modules/puppeteer/src/node/BrowserRunner.ts:268:9) 0|node-red | at Interface.<anonymous> (/home/marcel/.node-red/node_modules/puppeteer/src/node/BrowserRunner.ts:254:50) 0|node-red | at Interface.emit (node:events:539:35) 0|node-red | at Interface.emit (node:domain:475:12) 0|node-red | at Interface.close (node:internal/readline/interface:529:10) 0|node-red | at Socket.onend (node:internal/readline/interface:258:10) 0|node-red | at Socket.emit (node:events:539:35) 0|node-red | at Socket.emit (node:domain:475:12) 0|node-red | at endReadableNT (node:internal/streams/readable:1342:12) 0|node-red | at processTicksAndRejections (node:internal/process/task_queues:83:21)

this means i need pupeteer if i read this correct. will try this now

Tsamsiyu1 commented 1 year ago

OK not installing puppeteer fixes it but installing some dependencies. i installed pupperteer new again and after that didn´t helt this fixed it: apt-get install libnss3 libxss1 libasound2 libatk-bridge2.0-0 libgtk-3-0 libgbm-dev