open-wa / wa-automate-nodejs

💬 🤖 The most reliable tool for chatbots with advanced features. Be sure to 🌟 this repository for updates!
https://docs.openwa.dev/
Other
3.05k stars 588 forks source link

App dies after the first message #3222

Closed arthurd2 closed 1 week ago

arthurd2 commented 1 week ago

Are you using the latest version of the library?

What type of session are you experiencing this issue on?

Multi-device and I have set multiDevice to true in my config OR am using the --multi-device flag

What type of host account are you experiencing this issue on?

Personal account (normal)

Mode

EASY API/CLI

Current Behavior

After QR code authentication, the app works, waiting for a message. After this first message it dies complaining about an calling a FN variable which is not a function. (image attached)

Expected Behavior

receive and print messages on the console

Steps To Reproduce

async function processMessage( message ){ if ( message ) { console.log( message ); } }


### create() code OR full CLI command + CONFIG

_No response_

### DEBUG INFO

```markdown
{
  "WA_VERSION": "2.3000.1014402616",
  "WA_AUTOMATE_VERSION": "4.71.13",
  "BROWSER_VERSION": "HeadlessChrome/125.0.6422.141",
  "START_TS": 1719027152752,
  "RAM_INFO": "Total: 33.42 GB | Free: 2.50 GB",
  "PPTR_VERSION": "19.11.1",
  "LATEST_VERSION": true,
  "CLI": false,
  "PATCH_HASH": "e4663",
  "LAUNCH_TIME_MS": 10420,
  "ACC_TYPE": "PERSONAL",
  "chats": 1153,
  "messages": 143,
  "contacts": 16565,
  "isBiz": false,
  "isMd": true,
  "INSTANCE_ID": "330dd469-92b8-444e-a193-7ddd2b892b22"
}

Environment

- OS: Linux 6.5
- Node: 22.2.0
- npm: 10.8.1

Screenshots/Logs

image

Anything else?

No response

arthurd2 commented 1 week ago

On create() I've replaced the:

.then( client => { client.onAnyMessage( processMessage(message,client)) )} );

for

.then(client => start(client));
async function start(client) {
    client.onAnyMessage(async message => processMessage(message,client) )
}