wppconnect-team / wppconnect

WPPConnect is an open source project developed by the JavaScript community with the aim of exporting functions from WhatsApp Web to the node, which can be used to support the creation of any interaction, such as customer service, media sending, intelligence recognition based on phrases artificial and many other things, use your imagination
https://wppconnect.io
Other
1.92k stars 336 forks source link

Session not resuming after restart it #1384

Closed roysG closed 2 years ago

roysG commented 2 years ago

Description:

I scan qr code Logged in, wait at least 2 minutes Restart the browser. The browser loading but the session stack and restart himself with error:

The errors:

Status Session: phoneNotConnected whatsappWebApiV2.js:1243Session name: d7a981b0aa147f4e14203b793dec9165 whatsappWebApiV2.js:1309Phone not connected

It started a few minutes ago. i updated yesterday to latest version I am using proxy with no any problem

[Description of the bug, When Issue Happens]

Environment

Terminal Code:

info:


| | / / \/ \/ __/_ __ ___ __/ / | | /| / / // / // / / / \/ \/ \/ _ \/ _/ / | |/ |/ / __/ ___/ // // / / / / / / / / // /
|/|// // _/____// /// //\/_/\/ info: Checking for updates serverId: d7a981b0aa147f4e14203b793dec9165 leftSecondFromStoppedLoop 1.284 leftSecondFromStoppedLoop 2.284 info: You're up to date info: [d7a981b0aa147f4e14203b793dec9165:browser] Using browser folder './tokens/d7a981b0aa147f4e14203b793dec9165' info: [d7a981b0aa147f4e14203b793dec9165:browser] Initializing browser... info: [d7a981b0aa147f4e14203b793dec9165:client] Initializing... leftSecondFromStoppedLoop 3.285 leftSecondFromStoppedLoop 4.286 url: https://api.msgto.io/whatsapp/setLastTimeSentMsg p: {"serverId":"d7a981b0aa147f4e14203b793dec9165"} object LOADING_SCREEN 0 WhatsApp info: [d7a981b0aa147f4e14203b793dec9165:client] WhatsApp WEB version: 2.2234.13 info: [d7a981b0aa147f4e14203b793dec9165:client] WA-JS version: 2.13.3 Status Session: isLogged Session name: d7a981b0aa147f4e14203b793dec9165

warn: [d7a981b0aa147f4e14203b793dec9165:client] Phone not connected Status Session: phoneNotConnected Session name: d7a981b0aa147f4e14203b793dec9165 Phone not connected (SIGINT) Shutting down...

It happens after 60 sec

The wppConnect conection:

wppconnect.create({ catchQR: async (base64Qrimg, asciiQR, attempts, urlCode) => { this.lastTimeSendingMsgLooped = new Date().toJSON(); //important line, leave it here!

            console.log('Number of attempts to read the qrcode: ', attempts);
            //console.log('Terminal qrcode: ', asciiQR);
            console.log('base64 image string qrcode: ', base64Qrimg);
            //console.log('urlCode (data-ref): ', urlCode);

            this.sendQrCode(base64Qrimg);

            if(this.server.isLogged) {
                await Api.put('/whatsapp/removeAuth',{serverId:this.server._id});
            }
        },
        statusFind: (statusSession, session) => {
            console.log('Status Session: ', statusSession); //return isLogged || notLogged || browserClose || qrReadSuccess || qrReadFail || autocloseCalled || desconnectedMobile || deleteToken
            //Create session wss return "serverClose" case server for close
            if(statusSession === 'browserClose') {
                this.closeService();
            }

            console.log('Session name: ', session);

        },
        onLoadingScreen: (percent, message) => {
            Api.put('/whatsapp/setLastTimeSentMsg',{serverId:this.serverId}); //not need it

            console.log('LOADING_SCREEN', percent, message);
            this.lastTimeSendingMsgLooped = new Date().toJSON();
        },

        browserArgs: [
            '--proxy-server=' + newProxyUrl,
            '--no-sandbox',
            '--disable-setuid-sandbox',
        ],
        session: this.serverId, //Pass the name of the client you want to start the bot
        useChrome:true,
        puppeteerOptions: {
            userDataDir: './tokens/'+this.serverId, // or your custom directory
            executablePath: process.platform === 'linux' ? "/usr/bin/google-chrome" : "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",
        },

        headless: process.platform === 'linux' ? true : false,
        devtools: false, // Open devtools by default
        debug: true, // Opens a debug session
        logQR: true, // Logs QR automatically in terminal
        browserWS: '', // If u want to use browserWSEndpoint

        disableWelcome: false, // Option to disable the welcoming message which appears in the beginning
        updatesLog: true, // Logs info updates automatically in terminal
        autoClose: 0, // Automatically closes the wppconnect only when scanning the QR code (default 60 seconds, if you want to turn it off, assign 0 or false)
        tokenStore: 'file', // Define how work with tokens, that can be a custom interface
        folderNameToken: './tokens', //folder name when saving tokens

        // BrowserSessionToken
        // To receive the client's token use the function await clinet.getSessionTokenBrowser()
    })

......

The phone is active and get and send messages without any problem

voxsoftware commented 2 years ago

same problem here, always shows phone not connected.

voxsoftware commented 2 years ago

Session not resuming. Shows phone not connected. What means that error? is multidevice

info:     Checking for updates
info:     You're up to date
info:     [84b98314a4f0d55f05930518d9a950ef7630c569:browser] Using browser folder '/path/to/sessions/xxxxx'
info:     [84b98314a4f0d55f05930518d9a950ef7630c569:browser] Initializing browser...
info:     [84b98314a4f0d55f05930518d9a950ef7630c569:client] Initializing...
info:     [84b98314a4f0d55f05930518d9a950ef7630c569:client] WhatsApp WEB version: 2.2234.13
info:     [84b98314a4f0d55f05930518d9a950ef7630c569:client] WA-JS version: 2.13.4
info:     [84b98314a4f0d55f05930518d9a950ef7630c569:client] Auto close configured to 600s
info:     [84b98314a4f0d55f05930518d9a950ef7630c569:client] Auto close configured to 600s
warn:     [84b98314a4f0d55f05930518d9a950ef7630c569:client] Phone not connected
info:     [84b98314a4f0d55f05930518d9a950ef7630c569:client] Closing the page
roysG commented 2 years ago

I need to do a 3 to 5 restart randomly until it the connection works again. This problem started a few days ago.

It also happens in 1.71.1 and latest version

בתאריך יום ו׳, 28 באוק׳ 2022 ב-22:15 מאת Michael James (Kodhe) < @.***>:

Session not resuming. Shows phone not connected. What means that error? is multidevice

info: Checking for updates info: You're up to date info: [84b98314a4f0d55f05930518d9a950ef7630c569:browser] Using browser folder '/path/to/sessions/xxxxx' info: [84b98314a4f0d55f05930518d9a950ef7630c569:browser] Initializing browser... info: [84b98314a4f0d55f05930518d9a950ef7630c569:client] Initializing... info: [84b98314a4f0d55f05930518d9a950ef7630c569:client] WhatsApp WEB version: 2.2234.13 info: [84b98314a4f0d55f05930518d9a950ef7630c569:client] WA-JS version: 2.13.4 info: [84b98314a4f0d55f05930518d9a950ef7630c569:client] Auto close configured to 600s info: [84b98314a4f0d55f05930518d9a950ef7630c569:client] Auto close configured to 600s warn: [84b98314a4f0d55f05930518d9a950ef7630c569:client] Phone not connected info: [84b98314a4f0d55f05930518d9a950ef7630c569:client] Closing the page

— Reply to this email directly, view it on GitHub https://github.com/wppconnect-team/wppconnect/issues/1384#issuecomment-1295362844, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABXZDOXJXHWNWGIXMUGRZBLWFQQ3PANCNFSM6AAAAAARL2R564 . You are receiving this because you authored the thread.Message ID: @.***>

antirek commented 2 years ago

see #1366

roysG commented 2 years ago

Still hapenning, also in the latest version 1.19.0

roysG commented 2 years ago

@renat473, Why did you close it? this problem still hapenning!

edgardmessias commented 2 years ago

@roysG , please, increase the log detail and reopen the issue: https://wppconnect.io/docs/tutorial/basics/configuring-logger

roysG commented 2 years ago

Ok, i changed the log to "silly", this is the logs:

TAILING] Tailing last 15 lines for [xxx999] process (change the value with --lines option)

0|xxx999 | env prod serverId undefined 0|xxx999 | whatsappWebApi.serverId xxx999 0|xxx999 | dirname /root/msgto/server 0|xxx999 | this.lastTimeSendingMsgLooped 1 0|xxx999 | this.lastTimeSendingMsgLooped 2 2022-11-13T22:12:26.008Z 0|xxx999 | url: https://api.msgto.io/whatsapp/serverInfo?serverId=xxx999 0|xxx999 | url: https://api.msgto.io/whatsapp/customerInfo?customerId=xxx99911 0|xxx999 | url: https://api.msgto.io/whatsapp/serverInfo?serverId=xxx999 0|xxx999 | info: 0|xxx999 | _ __ __ 0|xxx999 | | | / / \/ \/ __/_ _ ___/ / 0|xxx999 | | | /| / / // / /_/ / / / \/ \/ \/ \/ / / 0|xxx999 | | |/ |/ / __/ __/ /__/ // / / / / / / / / // / 0|xxx999 | |/|// // __/__// /// //\/_/\/ 0|xxx999 | info: Checking for updates 0|xxx999 | serverId: xxx999 0|xxx999 | info: You're up to date 0|xxx999 | info: [xxx999:browser] Using browser folder './tokens/xxx999' 0|xxx999 | info: [xxx999:browser] Initializing browser... 0|xxx999 | http: [xxx999:browser] checking headless... 0|xxx999 | http: [xxx999:browser] headless option is active, browser hidden 0|xxx999 | info: [xxx999:client] Initializing... 0|xxx999 | http: [xxx999:client] Waiting page load 0|xxx999 | verbose: [xxx999:token] Injecting session token 0|xxx999 | verbose: [xxx999:client] Setting WhatsApp WEB version to 2.2234.x 0|xxx999 | leftSecondFromStoppedLoop 1.241 0|xxx999 | verbose: [xxx999:client] Loading WhatsApp WEB 0|xxx999 | verbose: [xxx999:client] WhatsApp WEB loaded 0|xxx999 | leftSecondFromStoppedLoop 2.242 0|xxx999 | verbose: [xxx999:page] Page loaded 0|xxx999 | verbose: [xxx999:client] Injecting wapi.js 0|xxx999 | leftSecondFromStoppedLoop 3.243 0|xxx999 | leftSecondFromStoppedLoop 4.243 0|xxx999 | leftSecondFromStoppedLoop 5.244 0|xxx999 | leftSecondFromStoppedLoop 6.243 0|xxx999 | verbose: [xxx999:client] wapi.js injected 0|xxx999 | debug: [xxx999:client] Exposing onMessage function 0|xxx999 | info: [xxx999:client] WhatsApp WEB version: 2.2234.13 0|xxx999 | http: [xxx999:client] Checking is logged... 0|xxx999 | info: [xxx999:client] WA-JS version: 2.15.1 0|xxx999 | debug: [xxx999:client] Exposing onAnyMessage function 0|xxx999 | http: [xxx999:client] Authenticated 0|xxx999 | Status Session: isLogged 0|xxx999 | Session name: xxx999 0|xxx999 | debug: [xxx999:client] Exposing onAck function 0|xxx999 | leftSecondFromStoppedLoop 7.245 0|xxx999 | debug: [xxx999:client] Exposing onNotificationMessage function 0|xxx999 | debug: [xxx999:client] Exposing onParticipantsChanged function 0|xxx999 | debug: [xxx999:client] Exposing onStateChange function 0|xxx999 | debug: [xxx999:client] Exposing onStreamChange function 0|xxx999 | debug: [xxx999:client] Exposing onIncomingCall function 0|xxx999 | http: [xxx999:client] Checking phone is connected... 0|xxx999 | debug: [xxx999:client] Exposing onInterfaceChange function 0|xxx999 | debug: [xxx999:client] Exposing onPresenceChanged function 0|xxx999 | debug: [xxx999:client] Exposing onLiveLocation function 0|xxx999 | debug: [xxx999:client] Exposing onAddedToGroup function 0|xxx999 | debug: [xxx999:client] Exposing onRevokedMessage function 0|xxx999 | debug: [xxx999:client] Exposing onReactionMessage function 0|xxx999 | http: [xxx999:client] Current state: SYNCING (CONNECTING) 0|xxx999 | verbose: [xxx999:token] Updating session token 0|xxx999 | verbose: [xxx999:token] Session token updated 0|xxx999 | leftSecondFromStoppedLoop 8.245 0|xxx999 | leftSecondFromStoppedLoop 9.246 0|xxx999 | leftSecondFromStoppedLoop 10.245 0|xxx999 | leftSecondFromStoppedLoop 11.245 0|xxx999 | leftSecondFromStoppedLoop 12.245 0|xxx999 | leftSecondFromStoppedLoop 13.246 0|xxx999 | leftSecondFromStoppedLoop 14.246 0|xxx999 | url: https://api.msgto.io/whatsapp/setLastTimeSentMsg p: {"serverId":"xxx999"} object 0|xxx999 | LOADING_SCREEN 0 התחברות... 0|xxx999 | http: [xxx999:client] Current state: SYNCING (CONNECTING) 0|xxx999 | leftSecondFromStoppedLoop 0.465 0|xxx999 | leftSecondFromStoppedLoop 1.465 0|xxx999 | leftSecondFromStoppedLoop 2.465 0|xxx999 | http: [xxx999:client] Current state: SYNCING (CONNECTING) 0|xxx999 | http: [xxx999:client] Current state: SYNCING (CONNECTING) 0|xxx999 | leftSecondFromStoppedLoop 3.466 0|xxx999 | url: https://api.msgto.io/whatsapp/setLastTimeSentMsg p: {"serverId":"xxx999"} object 0|xxx999 | LOADING_SCREEN 0 מוריד הודעות: %0 0|xxx999 | leftSecondFromStoppedLoop 0.178 0|xxx999 | leftSecondFromStoppedLoop 1.657 0|xxx999 | leftSecondFromStoppedLoop 2.672 0|xxx999 | leftSecondFromStoppedLoop 3.673 0|xxx999 | url: https://api.msgto.io/whatsapp/setLastTimeSentMsg p: {"serverId":"xxx999"} object 0|xxx999 | LOADING_SCREEN 1 מוריד הודעות: %1 0|xxx999 | leftSecondFromStoppedLoop 0.134 0|xxx999 | leftSecondFromStoppedLoop 1.134 0|xxx999 | url: https://api.msgto.io/whatsapp/setLastTimeSentMsg p: {"serverId":"xxx999"} object 0|xxx999 | LOADING_SCREEN 2 מוריד הודעות: %2 0|xxx999 | leftSecondFromStoppedLoop 0.133 0|xxx999 | url: https://api.msgto.io/whatsapp/setLastTimeSentMsg p: {"serverId":"xxx999"} object 0|xxx999 | LOADING_SCREEN 3 מוריד הודעות: %3 0|xxx999 | leftSecondFromStoppedLoop 0.109 0|xxx999 | url: https://api.msgto.io/whatsapp/setLastTimeSentMsg p: {"serverId":"xxx999"} object 0|xxx999 | LOADING_SCREEN 4 מוריד הודעות: %4 0|xxx999 | leftSecondFromStoppedLoop 0.12 0|xxx999 | url: https://api.msgto.io/whatsapp/setLastTimeSentMsg p: {"serverId":"xxx999"} object 0|xxx999 | LOADING_SCREEN 5 מוריד הודעות: %5 0|xxx999 | leftSecondFromStoppedLoop 0.114 0|xxx999 | url: https://api.msgto.io/whatsapp/setLastTimeSentMsg p: {"serverId":"xxx999"} object 0|xxx999 | LOADING_SCREEN 6 מוריד הודעות: %6 0|xxx999 | leftSecondFromStoppedLoop 0.102 0|xxx999 | leftSecondFromStoppedLoop 1.102 0|xxx999 | leftSecondFromStoppedLoop 2.103 0|xxx999 | url: https://api.msgto.io/whatsapp/setLastTimeSentMsg p: {"serverId":"xxx999"} object 0|xxx999 | LOADING_SCREEN 7 מוריד הודעות: %7 0|xxx999 | leftSecondFromStoppedLoop 0.016 0|xxx999 | http: [xxx999:client] Current state: SYNCING (SYNCING) 0|xxx999 | leftSecondFromStoppedLoop 1.019 0|xxx999 | leftSecondFromStoppedLoop 2.019 0|xxx999 | leftSecondFromStoppedLoop 3.02 0|xxx999 | url: https://api.msgto.io/whatsapp/setLastTimeSentMsg p: {"serverId":"xxx999"} object 0|xxx999 | LOADING_SCREEN 8 מוריד הודעות: %8 0|xxx999 | leftSecondFromStoppedLoop 0.808 0|xxx999 | leftSecondFromStoppedLoop 1.809 0|xxx999 | leftSecondFromStoppedLoop 2.809 0|xxx999 | url: https://api.msgto.io/whatsapp/setLastTimeSentMsg p: {"serverId":"xxx999"} object 0|xxx999 | LOADING_SCREEN 9 מוריד הודעות: %9 0|xxx999 | leftSecondFromStoppedLoop 0.213 0|xxx999 | leftSecondFromStoppedLoop 1.212 0|xxx999 | leftSecondFromStoppedLoop 2.213 0|xxx999 | leftSecondFromStoppedLoop 3.214 0|xxx999 | url: https://api.msgto.io/whatsapp/setLastTimeSentMsg p: {"serverId":"xxx999"} object 0|xxx999 | LOADING_SCREEN 10 מוריד הודעות: %10 0|xxx999 | leftSecondFromStoppedLoop 0.173 0|xxx999 | url: https://api.msgto.io/whatsapp/setLastTimeSentMsg p: {"serverId":"xxx999"} object 0|xxx999 | LOADING_SCREEN 11 מוריד הודעות: %11 0|xxx999 | leftSecondFromStoppedLoop 0.173 0|xxx999 | url: https://api.msgto.io/whatsapp/setLastTimeSentMsg p: {"serverId":"xxx999"} object 0|xxx999 | LOADING_SCREEN 12 מוריד הודעות: %12 0|xxx999 | leftSecondFromStoppedLoop 0.178 0|xxx999 | leftSecondFromStoppedLoop 1.177 0|xxx999 | leftSecondFromStoppedLoop 2.178 0|xxx999 | url: https://api.msgto.io/whatsapp/setLastTimeSentMsg p: {"serverId":"xxx999"} object 0|xxx999 | LOADING_SCREEN 13 מוריד הודעות: %13 0|xxx999 | leftSecondFromStoppedLoop 0.014 0|xxx999 | leftSecondFromStoppedLoop 1.015 0|xxx999 | leftSecondFromStoppedLoop 2.016 0|xxx999 | leftSecondFromStoppedLoop 3.017 0|xxx999 | leftSecondFromStoppedLoop 4.017 0|xxx999 | url: https://api.msgto.io/whatsapp/setLastTimeSentMsg p: {"serverId":"xxx999"} object 0|xxx999 | LOADING_SCREEN 14 מוריד הודעות: %14 0|xxx999 | leftSecondFromStoppedLoop 0.736 0|xxx999 | leftSecondFromStoppedLoop 1.737 0|xxx999 | leftSecondFromStoppedLoop 2.737 0|xxx999 | url: https://api.msgto.io/whatsapp/setLastTimeSentMsg p: {"serverId":"xxx999"} object 0|xxx999 | LOADING_SCREEN 15 מוריד הודעות: %15 0|xxx999 | leftSecondFromStoppedLoop 0.723 0|xxx999 | leftSecondFromStoppedLoop 1.724 0|xxx999 | leftSecondFromStoppedLoop 2.723 0|xxx999 | leftSecondFromStoppedLoop 3.724 0|xxx999 | leftSecondFromStoppedLoop 4.724 0|xxx999 | url: https://api.msgto.io/whatsapp/setLastTimeSentMsg p: {"serverId":"xxx999"} object 0|xxx999 | LOADING_SCREEN 16 מוריד הודעות: %16 0|xxx999 | leftSecondFromStoppedLoop 0.617 0|xxx999 | leftSecondFromStoppedLoop 1.616 0|xxx999 | leftSecondFromStoppedLoop 2.617 0|xxx999 | url: https://api.msgto.io/whatsapp/setLastTimeSentMsg p: {"serverId":"xxx999"} object 0|xxx999 | LOADING_SCREEN 17 מוריד הודעות: %17 0|xxx999 | leftSecondFromStoppedLoop 0.632 0|xxx999 | url: https://api.msgto.io/whatsapp/setLastTimeSentMsg p: {"serverId":"xxx999"} object 0|xxx999 | LOADING_SCREEN 18 מוריד הודעות: %18 0|xxx999 | leftSecondFromStoppedLoop 0.627 0|xxx999 | leftSecondFromStoppedLoop 1.626 0|xxx999 | leftSecondFromStoppedLoop 2.627 0|xxx999 | warn: [xxx999:client] Phone not connected 0|xxx999 | Status Session: phoneNotConnected 0|xxx999 | Session name: xxx999 0|xxx999 | Phone not connected 0|xxx999 | (SIGINT) Shutting down... 0|xxx999 | env prod serverId undefined 0|xxx999 | whatsappWebApi.serverId xxx999 0|xxx999 | __dirname /root/msgto/server 0|xxx999 | this.lastTimeSendingMsgLooped 1 0|xxx999 | this.lastTimeSendingMsgLooped 2 2022-11-13T22:13:37.332Z 0|xxx999 | url: https://api.msgto.io/whatsapp/serverInfo?serverId=xxx999 0|xxx999 | url: https://api.msgto.io/whatsapp/customerInfo?customerId=xxx99911 0|xxx999 | url: https://api.msgto.io/whatsapp/serverInfo?serverId=xxx999 0|xxx999 | info:

roysG commented 2 years ago

?