Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

whatsapp stuck in Current state: SYNCING (OPENING) #2276

Open
mszpr opened this issue Jul 17, 2024 · 10 comments
Open

whatsapp stuck in Current state: SYNCING (OPENING) #2276

mszpr opened this issue Jul 17, 2024 · 10 comments
Labels
bug Something isn't working needs triage

Comments

@mszpr
Copy link

mszpr commented Jul 17, 2024

Description

Hello,
When i launch new client, whatsapp crash and stop on status SYNCING (OPENING),
then I had to delete token folder then everything return in good, then after one, two days this issue returned

Environment

  • WPPConnect version(s): ^1.32.4
  • WA-JS version(s): ^3.2.4
  • Browser: Chrome
  • OS: ubuntu
  • Node version: v20.8.0
  • WhatsApp version: 2.3000.1014792822
  • MultiDevice (BETA): yes

Steps to Reproduce

  1. launch client
  2. whatsapp stuck in Current state: SYNCING (OPENING)
  3. delete token folder
  4. re-launch client
  5. after 1,2 days this issue returned.

Log Output

^[[32minfo^[[39m:     [113877:browser] Using browser folder '/var/www/tokens/113877'
^[[32minfo^[[39m:     [113877:browser] Initializing browser...
^[[32mhttp^[[39m:     [113877:browser] checking headless...
^[[32mhttp^[[39m:     [113877:browser] headless option is active, browser hidden
^[[32minfo^[[39m:     [113877:client] Initializing...
^[[36mverbose^[[39m:  [113877:client] Setting WhatsApp WEB version to 2.3000.10147x
^[[36mverbose^[[39m:  [113877:client] Loading WhatsApp WEB
^[[36mverbose^[[39m:  [113877:page] Page loaded
^[[36mverbose^[[39m:  [113877:client] Injecting wapi.js
^[[36mverbose^[[39m:  [113877:client] WhatsApp WEB loaded
[X] -----------  Client 113877 Has been created ----------- [X]
^[[36mverbose^[[39m:  [113877:client] wapi.js injected
^[[32minfo^[[39m:     [113877:client] WhatsApp WEB version: 2.3000.1014792822
^[[32minfo^[[39m:     [113877:client] WA-JS version: 3.6.0
[x] Client 113877 Status => [loading_screen]
^[[32mhttp^[[39m:     [113877:client] Current state: SYNCING (CONNECTING)
^[[32mhttp^[[39m:     [113877:client] Current state: SYNCING (OPENING)

Your Code

const getDirectories = async source =>
  (await readdir(source, { withFileTypes: true }))
    .filter(dirent => dirent.isDirectory())
    .map(dirent => dirent.name);

class Instance{

constructor(){
    this.restorePreviousSessions();
  }

createInstance(session_id){
 var options = {
        session: session_id,
        browserArgs: [
          '--disable-setuid-sandbox',
          '--no-sandbox',
          '--safebrowsing-disable-auto-update',
          '--disable-features=LeakyPeeker' // Disable the browser's sleep mode when idle, preventing the browser from going into sleep mode, this is useful for WhatsApp not to be in economy mode in the background, avoiding possible crashes
        ],
        puppeteerOptions: {
            userDataDir: `${__dirname}/tokens/${session_id}`,
            args: ['--no-sandbox','--disable-setuid-sandbox'],
            executablePath: process.env.ENV == 'local' ? '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome' : '/usr/bin/google-chrome',
        },
        disableWelcome:true,
        headless:true,
        onLoadingScreen: (percent, message) => { onLoadingScreen (percent, message)},
        catchQR: (base64Qr, asciiQR, attempt, urlCode) => { onQrCode(base64Qr, asciiQR, attempt, urlCode) },
        statusFind: (statusFind) => { onStatus(statusFind) },
        catchLinkCode: (code) => { onLoginCode(code) },
        logQR:false,
      }

 client = await wppconnect.create(options);
}
}

  async restorePreviousSessions() {

    const directoryNames = await getDirectories(
      __dirname+"/tokens"
    );

    const sessionIds = directoryNames.map(name => name);

    sessionIds.forEach((sessionId,index) => {

      setTimeout(() => {
        console.log(`initialize session id => ${sessionId}`);
        this.createInstance(sessionId);
      }, process.env.RUNTIMEOUT || 20000 * (index + 1));
      
    });
    
  }

Additional context / Screenshot

when i set headless:false, the whatsapp web page says that i don't have internet connection, even i have
2024-07-17 19 23 51

@mszpr mszpr added bug Something isn't working needs triage labels Jul 17, 2024
@Saifallak
Copy link

related wppconnect-team/wppconnect-server#1486 but closed as not-planned.

@mszpr
Copy link
Author

mszpr commented Jul 18, 2024

@Saifallak i face this issue with some sessions not all, this is weird ! I've tried to debug it with no results.
I hope someone find the solution

@Saifallak
Copy link

@Saifallak i face this issue with some sessions not all, this is weird ! I've tried to debug it with no results. I hope someone find the solution

Only solution is to delete it, but its hard to identify because it says connected is session status endpoint

@tls-jil
Copy link

tls-jil commented Jul 26, 2024

also i face same issue

Group 79 (1)

Copy link

@tls-jil, ⭐3 XP earned, 🏆First Comment Added completed, 💪Level 1 achieved!
Contribute more to raise your XP/Level, complete challenges for extra achievements! [Sign up for personal dashboard]

icon

@Saifallak
Copy link

Any solution so far?

@icleitoncosta
Copy link
Contributor

Hi, the error yet ocurrs with you? I fixed it in previous versions

@Saifallak
Copy link

Hi, the error yet ocurrs with you? I fixed it in previous versions

Last time happened 2 weeks ago for me,
Not sure if disappeared because of update, because it literally happens randomly,
But curious 🤔 which update you did fixed it?.

Any way I'll monitor session for next week and give you feedback

@icleitoncosta
Copy link
Contributor

The updates that were made to improve this, but it has been over 3 weeks since then, that's how I upgraded to version 2.3000, and mainly it's necessary to always keep the WhatsApp version updated or just update the project, which will automatically keep up.

@Saifallak
Copy link

The updates that were made to improve this, but it has been over 3 weeks since then, that's how I upgraded to version 2.3000, and mainly it's necessary to always keep the WhatsApp version updated or just update the project, which will automatically keep up.

Yes, usually i stop all sessions and 'git pull' rebuild every two weeks., anyway I'll test and get feedback here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triage
Projects
None yet
Development

No branches or pull requests

4 participants