wa-automate-nodejs icon indicating copy to clipboard operation
wa-automate-nodejs copied to clipboard

Catch and handle unauthenticated session without restarting the process.

Open daopapp opened this issue 3 years ago • 7 comments

Are you using the latest version of the library?

  • [X] I have checked and am using the latest version of the library.

Are you using Multi-device?

  • [X] I am using a multi-device session and I have set multiDevice to true in my config OR am using the --multi-device flag

Current Behavior

Im trying to start a host with no MD and it's happen 2 things:

  1. The generate of session data it's very slow....
  2. After generate the session.data.json, when i start the docker host, the process it's getting in loop with error - - Session data most likely expired due to manual host account logout. Please re-authenticate this session.

To avoid this error, i try to start as a MD and i get the same error - Session data most likely expired due to manual host account logout. Please re-authenticate this session.

Expected Behavior

Start the process with no MD OK

Steps To Reproduce

on version 4.23.14 start a docker process with no MD error - Session data most likely expired due to manual host account logout. Please re-authenticate this session.

Mode

EASY API/CLI

create() code

docker wa-automate

DEBUG INFO

{
  "WA_VERSION": "2.2144.11",
  "WA_AUTOMATE_VERSION": "4.23.14",
  "BROWSER_VERSION": "HeadlessChrome/79.0.3945.88",
  "START_TS": 1637152596019
}

Environment

- OS: Linux 4.15
- Node: 15.12.0
- npm: 7.6

Screenshots

No response

Anything else?

Error no MD:

┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓┃                                                                              ┃┃   @open-wa/wa-automate                                                       ┃┃   💬 🤖 The most reliable NodeJS whatsapp library for chatbots with          ┃┃   advanced features.                                                         ┃┃   Version: 4.23.12                                                           ┃┃   Check out the latest changes:                                              ┃┃   https://github.com/open-wa/wa-automate-nodejs#latest-changes               ┃┃                                                                              ┃┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
- Starting
- Version: 4.23.12
- Initializing WA
- Launching Browser
- Setting Up Browser
- Loading session data
- Found session data file: /usr/src/app/session.data.json
- Existing session data detected. Injecting...
- Existing session data injected
- Navigating to WA
- Page loaded in 815ms: 200
- Browser Launched
- Debug info: {
  "WA_VERSION": "2.2144.11",
  "PAGE_UA": "WhatsApp/2.2108.8 Mozilla/5.0 (Macintosh; Intel Mac OS X 11_2_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36",
  "WA_AUTOMATE_VERSION": "4.23.12 UPDATE AVAILABLE: 4.23.14",
  "BROWSER_VERSION": "HeadlessChrome/79.0.3945.88",
  "OS": "Linux 4.15",
  "START_TS": 1637152353636
}
- Use this easy pre-filled link to report an issue: https://github.com/open-wa/wa-automate-nodejs/issues/new?template=bug_report.yaml&debug_info=%7B%0A%20%20%22WA_VERSION%22:%20%222.2144.11%22,%0A%20%20%22WA_AUTOMATE_VERSION%22:%20%224.23.12%20UPDATE%20AVAILABLE:%204.23.14%22,%0A%20%20%22BROWSER_VERSION%22:%20%22HeadlessChrome/79.0.3945.88%22,%0A%20%20%22START_TS%22:%201637152353636%0A%7D&environment=-%20OS:%20Linux%204.15%0A-%20Node:%2015.12.0%0A-%20npm:%20%0A
- Injecting api
- WAPI injected
- Authenticating
- Session data most likely expired due to manual host account logout. Please re-authenticate this session.

Error on MD:
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓┃                                                                              ┃┃   @open-wa/wa-automate                                                       ┃┃   💬 🤖 The most reliable NodeJS whatsapp library for chatbots with          ┃┃   advanced features.                                                         ┃┃   Version: 4.23.14                                                           ┃┃   Check out the latest changes:                                              ┃┃   https://github.com/open-wa/wa-automate-nodejs#latest-changes               ┃┃                                                                              ┃┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
- Starting
- Version: 4.23.14
- Initializing WA
- Using custom chromium args with multi device will cause issues! Please remove themm
- It is recommended to set useChrome: true or use the --use-chrome flag if you are experiencing issues with Multi device support
- Launching Browser
- Setting Up Browser
- Loading session data
- Found session data file: /usr/src/app/session.data.json
- multi-device enabled. Session data skipped...
- Existing session data injected
- Navigating to WA
- Page loaded in 630ms: 200
- Browser Launched
- Debug info: {
  "WA_VERSION": "2.2144.11",
  "PAGE_UA": "WhatsApp/2.2108.8 Mozilla/5.0 (Macintosh; Intel Mac OS X 11_2_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36",
  "WA_AUTOMATE_VERSION": "4.23.14",
  "BROWSER_VERSION": "HeadlessChrome/79.0.3945.88",
  "OS": "Linux 4.15",
  "START_TS": 1637152596019
}
- Use this easy pre-filled link to report an issue: https://github.com/open-wa/wa-automate-nodejs/issues/new?template=bug_report.yaml&debug_info=%7B%0A%20%20%22WA_VERSION%22:%20%222.2144.11%22,%0A%20%20%22WA_AUTOMATE_VERSION%22:%20%224.23.14%22,%0A%20%20%22BROWSER_VERSION%22:%20%22HeadlessChrome/79.0.3945.88%22,%0A%20%20%22START_TS%22:%201637152596019%0A%7D&environment=-%20OS:%20Linux%204.15%0A-%20Node:%2015.12.0%0A-%20npm:%20%0A
- Injecting api
- WAPI injected
- Authenticating
- Session data most likely expired due to manual host account logout. Please re-authenticate this session.

daopapp avatar Nov 17 '21 12:11 daopapp

I get the same error since i started using multidevice.

julioagostini avatar Nov 19 '21 19:11 julioagostini

I got the same error without multidevice option, any ideas?

luangarcia avatar Nov 19 '21 21:11 luangarcia

@daopapp please DM me the whole docker command you're using with the flags and environmental variables

smashah avatar Nov 21 '21 05:11 smashah

@daopapp please DM me the whole docker command you're using with the flags and environmental variables

environment: WA_BROWSER_WS_ENDPOINT: 'http://browser:${CHROME_PORT}' WA_DISABLE_SPINS: 'true' WA_PORT: "${WA_PORT}" WA_KEY: ${WA_KEY} WA_WEBHOOK: ${WA_WEBHOOK} entrypoint: ["npx", "@open-wa/wa-automate", "--use-chrome", " --in-docker", "--port", "$${WA_PORT}", "--qr-timeout", "0", "--popup","--key","$${WA_KEY}",--webhook, "$${WA_WEBHOOK}"]

m7mdcc avatar Nov 25 '21 00:11 m7mdcc

@daopapp please DM me the whole docker command you're using with the flags and environmental variables

npx @open-wa/wa-automate --in-docker -p 9097 --npm-options=--ignore-scripts --authTimeout=0 --qrTimeout=0 -l xx-xxxxxx-xxxxxx-xxxxxx-xxxxxx -w https://xxx.xxxxx.io/whatsapp/message/xxxxxxxx

daopapp avatar Nov 25 '21 00:11 daopapp

@daopapp , Any chance that you have WA_BROWSER_WS_ENDPOINT enviroment var in your docker compose ?

m7mdcc avatar Nov 26 '21 20:11 m7mdcc

@daopapp , Any chance that you have WA_BROWSER_WS_ENDPOINT enviroment var in your docker compose ?

WA_BROWSER_WS_ENDPOINT: 'http://browser:3000'

daopapp avatar Nov 29 '21 12:11 daopapp