Search code examples
node.jsexpresswhatsapp

Whatsapp-web.js package failing when scanning the QR code


client = new Client({
            authStrategy: new LocalAuth({
                clientId: phoneNo,
                dataPath: sessionsPath,
            }),
            webVersionCache: {
                type: 'remote',
                remotePath:
                    'https://raw.githubusercontent.com/wppconnect-team/wa-version/main/html/2.3000.1014590669-alpha.html',
            },
            puppeteer: {
                headless: true, // or false if you want to see the browser
                args: ['--no-sandbox', '--disable-setuid-sandbox'], // other Chromium flags if needed
            },
            ...clientOpts,
        })

This is my code to initialize a client using whatsapp-web.js package

  • My issue is in the webVersionCache url I used the latest pushed here in the repo but it's not working any idea what is the issue here and how to solve it. Thanks

Lates commit link: https://github.com/wppconnect-team/wa-version/commit/bd46ca03c765648e9ce0f788670a788953d63fd8

I tried this link https://raw.githubusercontent.com/wppconnect-team/wa-version/main/html/2.3000.1014590669-alpha.html and I was expecting the qr code to pass but I got error Error: Evaluation failed: TypeError: Cannot read properties of undefined (reading 'default')


Solution

  • There is some sort of expiration date to those files ( in my situation is 2.2412.54.html file ) I am using WhatsApp web Js i uploaded the delete file in a personal repo and used it in my app but I get an infinite update page

    however, for anyone depending on those files for a WhatsApp web JS bot there is a solution that worked for me

    delete the current whatsapp-web.js you have from package.json and delete the node_module then install this

    npm install github:pedroslopez/whatsapp-web.js#webpack-exodus
    

    this version is from the WhatsApp web JS creator himself but on a different branch i don't know if it is stable or if there are features not included but for my use case it works fine and even without providing a webVersionCache for the bot client

     this.client = new Client({
         puppeteer: {
            headless: true,
         },
         authStrategy: new LocalAuth({
            clientId: this.id,
            dataPath: this.sessionPath,
         }),
      })
    

    working on my bot server