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.15k stars 601 forks source link

"Waiting for ripe session..." stays here forever, but OK on WA WEB. #3083

Closed nrs1022 closed 1 year ago

nrs1022 commented 1 year 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?

Business account

Mode

EASY API/CLI

Current Behavior

Hi @smashah! My @openwa yesterday stops working, I update @openwa to 4.61.2 but stays with "Waiting for ripe session...", I cleaned up everything and try again: QR was scanned fine after 2/3 tries and finally it finalized client initialization... But later session stops again, when I reboot @openwa it keeps again on "Waiting for ripe session..."

āœ“ Launch inject: 394ms āœ“ Authenticated šŸŒ• Waiting for ripe session...

If I scan QR through WA WEB it opens and works fine... maybe some inject stopped working with the recent WA changes?

Expected Behavior

"Waiting for ripe session..." last only a couple of seconds, chats are loaded and client finalized.

Steps To Reproduce

npx @open-wa/wa-automate --debug --verbose -p 8012 --multi-device --webhook http://127.0.0.1:9123/hook

create() code OR full CLI command + CONFIG

No response

DEBUG INFO

{
  "WA_VERSION": "2.2313.8",
  "WA_AUTOMATE_VERSION": "4.61.2",
  "BROWSER_VERSION": "HeadlessChrome/109.0.5412.0",
  "START_TS": 1680107036913,
  "RAM_INFO": "Total: 16.03 GB | Free: 11.21 GB",
  "PPTR_VERSION": "19.4.1",
  "LATEST_VERSION": true,
  "CLI": true
}

Environment

- OS: Linux 5.15
- Node: 18.9.0
- npm: 9.1.2

Screenshots/Logs

These are last lines using --debug

- Checking session integrity
info: Checking session integrity  {"data":"Checking session integrity","eventName":"STARTUP.session","eventNamespace":"STARTUP","sessionId":"session","timestamp":"2023-03-29T17:22:40.977Z"}
- Session integrity check passed
info: Session integrity check passed  {"data":"Session integrity check passed","eventName":"STARTUP.session","eventNamespace":"STARTUP","sessionId":"session","timestamp":"2023-03-29T17:22:40.980Z"}
info: GET SCRIPT: launch.js 65074 {"timestamp":"2023-03-29T17:22:40.981Z"}
- Launch inject: 392ms
info: Launch inject: 392ms  {"data":"Launch inject: 392ms","eventName":"STARTUP.session","eventNamespace":"STARTUP","sessionId":"session","timestamp":"2023-03-29T17:22:41.373Z"}
- WAPI injected
info: WAPI injected  {"data":"WAPI injected","eventName":"STARTUP.session","eventNamespace":"STARTUP","sessionId":"session","timestamp":"2023-03-29T17:22:41.374Z"}
- Authenticating
info: Authenticating  {"data":"Authenticating","eventName":"STARTUP.session","eventNamespace":"STARTUP","sessionId":"session","timestamp":"2023-03-29T17:22:41.374Z"}
- 0%:    WhatsApp
info: 0%:        WhatsApp  {"data":"0%:\t WhatsApp","eventName":"STARTUP.session","eventNamespace":"STARTUP","sessionId":"session","timestamp":"2023-03-29T17:22:50.663Z"}
info: internal_launch_progress.session  {"data":{"text":"WhatsApp","value":0},"eventName":"internal_launch_progress.session","eventNamespace":"internal_launch_progress","sessionId":"session","timestamp":"2023-03-29T17:22:50.663Z"}
info: AUTH.session  {"data":true,"eventName":"AUTH.session","eventNamespace":"AUTH","sessionId":"session","timestamp":"2023-03-29T17:22:50.695Z"}
info: AUTH.session  {"data":true,"eventName":"AUTH.session","eventNamespace":"AUTH","sessionId":"session","timestamp":"2023-03-29T17:22:50.696Z"}
info: AUTH.session  {"data":true,"eventName":"AUTH.session","eventNamespace":"AUTH","sessionId":"session","timestamp":"2023-03-29T17:22:50.697Z"}
info: AUTH.session  {"data":true,"eventName":"AUTH.session","eventNamespace":"AUTH","sessionId":"session","timestamp":"2023-03-29T17:22:50.698Z"}
- Authenticated
info: Authenticated  {"data":"Authenticated","eventName":"STARTUP.session","eventNamespace":"STARTUP","sessionId":"session","timestamp":"2023-03-29T17:22:50.716Z"}
info: Injected internal event handler: 117 ms {"timestamp":"2023-03-29T17:22:50.834Z"}
- Waiting for ripe session...
info: Waiting for ripe session...  {"data":"Waiting for ripe session...","eventName":"STARTUP.session","eventNamespace":"STARTUP","sessionId":"session","timestamp":"2023-03-29T17:22:50.879Z"}

Anything else?

If you need more info or tests please tell me, thanks!

aymenitc commented 1 year ago

Me too

Theblood commented 1 year ago

Me too help mee!!!

smashah commented 1 year ago

thanks for the issue template @nrs1022

I'm going to need your guys' help here.

first of all, in your production instances, pin the version to 4.61.0 which doesn't have this regression. It might take some time to load but it shouldn't have this exact problem.

I will be implementing two things in this upcoming fix. A way to save a screenshot mid-launch (just hit s on the keyboard in the terminal and it should dump a screenshot in your process working directory), and a potential fix to this problem.

Here's where I need your help @Theblood @nrs1022 @aymenitc, I cannot replicate this issue on my local machine. I need you guys to experiment with the upcoming version to see if you can replicate. If you can I want you to take screenshots any time your session gets stuck.

Remember, you'll only need to hit s on your keyboard to take a screenshot.

The filename should look something like this:

screenshot_qrtesst2_1680127703440.png

screenshot, then your session id then a timestamp.

If you get to the point where it looks like it froze at finalizing client or waiting for ripe session then hit s and then we can possibly get some clues as to what's going on.

Thanks

nrs1022 commented 1 year ago

Hi @smashah understood, using 4.61.0 works fine. Anyway, I'm trying with another session using 4.62.1 which stays stucked. I press s key but does nothing (I'm using putty for access to a Linux terminal)

smashah commented 1 year ago

4.62.1 is definitely broken. 4.62.2 is only somewhat unreliable

nrs1022 commented 1 year ago

4.62.1 is definitely broken. 4.62.2 is only somewhat unreliable

Well, if you need some assistance I can help you as much as possible. No luck with s key, maybe am I doing something wrong?

WEBudoGT commented 1 year ago

hello @smashah How can I help to test? I'm running from docker-compose Mine takes some time (about 1 minute) on "waiting for ripe session" then it goes "well", but no messages are processed, and when checking health status vĆ­a API, it shows:

{ "success": true, "response": { "queuedMessages": 0, "state": "OPENING", "isPhoneDisconnected": true, "isHere": true, "wapiInjected": true, "online": true, "tryingToReachPhone": false, "retryingIn": 0, "isMd": true } }

smashah commented 1 year ago

@github-actions run

āš” Release! āš” ```js (async () => { function exec(cmd) { try { execSync(cmd, {stdio: 'inherit'}) } catch (error) { console.log(`Status Code: ${error.status} with '${error.message}'`); } } //set the version type process.env.VERS = "minor" // Config const gitUserEmail = "github-actions[bot]@users.noreply.github.com"; const gitUserName = "github-actions[bot]"; exec(`echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc`); exec(`git config --global user.email "${gitUserEmail}"`); exec(`git config --global user.name "${gitUserName}"`); exec(`npm i -D`); exec(`npm run release-ci $VERS`); // types only package exec('npm config set //registry.npmjs.org/:_authToken $NPM_TOKEN') exec(`npm config set //registry.npmjs.org/:_authToken $NPM_TOKEN && npm run types:publish `); exec(`git commit -a -m 'updated types-only package'`); exec(`git push --force`); //comment on the issue var result = execSync(`npx auto-changelog -o ./tempchangelog.txt --commit-limit false --template ./compact-keepachangelog.hbs --stdout`).toString(); await postComment(result); //create changelog image exec(`npm run release-image`); exec(`git commit -a -m 'updated release-image'`); exec(`git push --force`); })(); ```
smashah commented 1 year ago

Changelog

šŸš€ Release 4.62.0 (2023-03-30)

smashah commented 1 year ago

@nrs1022 @Theblood @WEBudoGT @aymenitc

Please try with this latest version using the CLI as a control:

> npx @open-wa/wa-automate@4.62.0 --session-id triage-3083 --debug -v --log-console-errors --log-console -p ... --webhook ...

replace ... with whatever you want. Don't add extra flags for now just so we can compare.

Two major differences with this version, you can hit s to take a screenshot, and the process will only waitForRipeSession for 5 seconds by default. You can change that with --wait-for-ripe-session-timeout 60 as an example to change it to 60 seconds.

Report back any further issues and respective logs (paste all of the logs, not just bits you think are important) and screenshots.

thanks

nrs1022 commented 1 year ago

Hi @smashah today I've tried new version in one of the sessions I use, unfortunately in "Wating for ripe session..." after 5 seconds it says something like "Maybe you have issues in headless mode, continuing" and finalizing client with 0 messages and 0 chats.

imagen

Image in spanish says "Make sure your computer has an active and stable Internet connection".

The tested session is now working fine with 4.61.0

Tomorrow I'll try to scan a new QR and so make a more detailed log from beginning.

smashah commented 1 year ago

@nrs1022 thanks for the screenshot that's exactly the thing I needed to confirm.

Please try again with a fresh session on 4.62.2

nrs1022 commented 1 year ago

@nrs1022 thanks for the screenshot that's exactly the thing I needed to confirm.

Please try again with a fresh session on 4.62.2

Yes, right, tomorrow I'll stop and retry with a fresh session and paste all logs.

smashah commented 1 year ago

Closing. Please comment if this is still happening