pedroslopez / whatsapp-web.js

A WhatsApp client library for NodeJS that connects through the WhatsApp Web browser app
https://wwebjs.dev
Apache License 2.0
14.53k stars 3.46k forks source link

WhatsApp does not work on v2.3XXX #2789

Open Eonus opened 4 months ago

Eonus commented 4 months ago

Is there an existing issue for this?

Describe the bug

Three days ago I started to receive the following error on account start: Evaluation failed: TypeError: Cannot read properties of undefined (reading 'push')\n at fillModuleArray (eval at <anonymous> (:2:5), <anonymous>:6:74)\n at moduleRaid (eval at <anonymous> (:2:5), <anonymous>:15:3)\n at puppeteer_evaluation_script:4:17

Expected behavior

As a user, I expect to be logged in and able to send messages. But I am seeing desribed error.

Steps to Reproduce the Bug or Issue

  1. Run basic example
  2. On some accounts it is not logged in

Relevant Code

No response

Browser Type

Chromium

WhatsApp Account Type

Standard

Does your WhatsApp account have multidevice enabled?

Yes, I am using Multi Device

Environment

OS: Linux and Windows whatsapp-web.js version: latest, installed directly from GitHub (https://github.com/pedroslopez/whatsapp-web.js/commit/ef2f725bce1bd1afd8491f9de0cd2ed06a6febc3) WhatsApp Web version: 2.3000.1011643235 Node.js version: v18.19.0

Additional context

  1. It is possible that the problem is related to new version (https://github.com/pedroslopez/whatsapp-web.js/commit/17c75ccf5f5a5103e80f8eaa08e641f065de4fea new 2.2408.1 wweb version)
  2. I found where error is thrown, it is inside moduleraid library (Related issue - https://github.com/pedroslopez/moduleRaid/issues/5)
  3. Other related issues - https://github.com/pedroslopez/whatsapp-web.js/issues/2785
Eonus commented 4 months ago

Please don't close this issue because I took the time to find the specific place where this error occurs. I've searched through existing issues and not a single potential duplicate mentions a solution. My previous issue was closed without any clarifications about reasons for that.

DRCHAZ commented 4 months ago

Same problem last 3 days

Eonus commented 4 months ago

This is the line which cause the problem (https://github.com/pedroslopez/moduleRaid/blob/1867c12241b0d6200bd0d8dc852e875d95278ea3/moduleraid.js#L14): image

DRCHAZ commented 4 months ago

Please help

ono77 commented 4 months ago

How do you get wweb version 2.3000? Last version seems to be 2.2408

DRCHAZ commented 4 months ago

As I see they are rolling out WhatsApp web v 2.3000 little by little, so bug need to be fixed.

Eonus commented 4 months ago

I get this version from Client.getWWebVersion https://docs.wwebjs.dev/Client.html#getWWebVersion

DRCHAZ commented 4 months ago

Any updates? Still receiving this error. After clearing session, reconnection of account passes couple of hours and error showing.

micmil1977 commented 4 months ago

Apparently they are moving from Webpack to some other framework called Comet. In order to reproduce the problem and get the 2.3000 version that is based on Comet you need to add a cookie: wa_build=c You can add it manually in DevTools and refresh the page. Hopefully this will help someone to figure out how to find the modules under Comet. As a temporary workaround for users that are already getting the Comet version, remove this cookie or change it to wa_build=w and refresh the page.

alechkos commented 4 months ago

Until the patch for wweb v2.3xxx is out use the webcache with wweb v2.2xxx https://github.com/pedroslopez/whatsapp-web.js/pull/1847 https://github.com/pedroslopez/whatsapp-web.js/issues/2293#issuecomment-1602462635

Relevant wweb versions can be found here

Kertis90 commented 4 months ago

Is there any update or solution related to this issue?

adisutomo89 commented 4 months ago

Screenshot 2024-03-08 175934

I use LocalAuth every time I want to reload the cache, the error message always appears, please help me

adisutomo89 commented 4 months ago

Screenshot 2024-03-08 175934

I use LocalAuth every time I want to reload the cache, the error message always appears, please help me

SOLVED Use :

webVersionCache: { type: 'remote', remotePath: 'https://raw.githubusercontent.com/wppconnect-team/wa-version/main/html/2.2410.1.html', }

rajeshshettysrs commented 3 months ago

Screenshot 2024-03-08 175934 I use LocalAuth every time I want to reload the cache, the error message always appears, please help me

SOLVED Use :

webVersionCache: { type: 'remote', remotePath: 'https://raw.githubusercontent.com/wppconnect-team/wa-version/main/html/2.2410.1.html', }

please share WAPI js file

tbsmark86 commented 3 months ago

The proposed workaround is not working for me but thanks for the push in the right direction. I changed it to a slightly older version:

    webVersionCache: {
                type: 'remote',
                remotePath: 'https://raw.githubusercontent.com/wppconnect-team/wa-version/main/html/2.2409.0.html',
            }
rajeshshettysrs commented 3 months ago

The proposed workaround is not working for me but thanks for the push in the right direction. I changed it to a slightly older version:

    webVersionCache: {
                type: 'remote',
                remotePath: 'https://raw.githubusercontent.com/wppconnect-team/wa-version/main/html/2.2409.0.html',
            }

Sir how to add in WAPI javascript file?

jaovitubr commented 3 months ago

Aparentemente, eles estão mudando do Webpack para algum outro framework chamado Comet. Para reproduzir o problema e obter a versão 2.3000 que é baseada no Comet você precisa adicionar um cookie: wa_build=c Você pode adicioná-lo manualmente no DevTools e atualizar a página. Espero que isso ajude alguém a descobrir como encontrar os módulos sob o Cometa. Como uma solução temporária para usuários que já estão recebendo a versão do Cometa, remova esse cookie ou altere-o para wa_build=w e atualize a página.

What framework is this? link plz

tinyCoder32 commented 3 months ago

Apparently they are moving from Webpack to some other framework called Comet. In order to reproduce the problem and get the 2.3000 version that is based on Comet you need to add a cookie: wa_build=c You can add it manually in DevTools and refresh the page. Hopefully this will help someone to figure out how to find the modules under Comet. As a temporary workaround for users that are already getting the Comet version, remove this cookie or change it to wa_build=w and refresh the page.

Not anymore, WhatsApp now immediately logs you out when you play with it.

alechkos commented 3 months ago
const wwebVersion = '2.2412.54';

const client = new Client({
    authStrategy: new LocalAuth(), // your authstrategy here
    puppeteer: {
        // puppeteer args here
    },
    // locking the wweb version
    webVersionCache: {
        type: 'remote',
        remotePath: `https://raw.githubusercontent.com/wppconnect-team/wa-version/main/html/${wwebVersion}.html`,
    },
});

Relevant WWeb versions can be found here

frankdors commented 3 months ago

Apparently they are moving from Webpack to some other framework called Comet. In order to reproduce the problem and get the 2.3000 version that is based on Comet you need to add a cookie: wa_build=c You can add it manually in DevTools and refresh the page. Hopefully this will help someone to figure out how to find the modules under Comet. As a temporary workaround for users that are already getting the Comet version, remove this cookie or change it to wa_build=w and refresh the page.

Here have a idea to get modules to new version...

Someone can help to convert moduleraid? https://d33gom43gwygbg.cloudfront.net/utils/api.js

PurpShell commented 3 months ago

Hey everyone! I haven't noticed that the update already started rolling out. I'll be updating moduleRaid to support the new version, it is very simple!

JL-Create commented 3 months ago

I've also encountered the same issue. I found that when I use the WA APP version 2.24.4.78, the cache loads and works normally. However, when I switch to using WA APP version 2.24.5.75, every time I try to load the cache, it always gives me this same error. My phone is an iPhone.

sergey-chechaev commented 3 months ago

You can find fix here https://github.com/wppconnect-team/wa-js/pull/1726/files

The main idea to find modules in require('__debug').modulesMap

jaovitubr commented 3 months ago

I created my own moduleRaid for my personal project, it was made to work with webpack and comet:

github.com/jaovitubr/moduleRaid

codeclass commented 3 months ago

Still receiving this error

Error: Evaluation failed: TypeError: Cannot read properties of undefined (reading 'push')
    at fillModuleArray (eval at <anonymous> (:2:5), <anonymous>:6:74)
    at moduleRaid (eval at <anonymous> (:2:5), <anonymous>:15:3)
    at __puppeteer_evaluation_script__:4:17
    at ExecutionContext._evaluateInternal (/home/whatsapp/whatsapp/node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:221:19)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async ExecutionContext.evaluate (/home/whatsapp/whatsapp/node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:110:16)
    at async Client.initialize (/home/whatsapp/whatsapp/src/Client.js:339:9)

any solutions?

this not working

complanboy2 commented 3 months ago

ModuleError: Requiring module "%s" with unresolved dependencies: %s

Getting this error

JL-Create commented 3 months ago

I've also encountered the same issue. I found that when I use the WA APP version 2.24.4.78, the cache loads and works normally. However, when I switch to using WA APP version 2.24.5.75, every time I try to load the cache, it always gives me this same error. My phone is an iPhone.

===================

After completing the following two steps, I resolved the issue

  1. alter src/util/Constants.js webVersion: '2.2410.1'
  2. alter const client = new Client({ authStrategy: new LocalAuth(), // your authstrategy here puppeteer: { // puppeteer args here }, webVersionCache: { type: 'remote', remotePath: https://raw.githubusercontent.com/wppconnect-team/wa-version/main/html/2.2410.1.html, }, });
MoudiZd commented 3 months ago

Any update on this? how to work around webpackChunkwhatsapp_web_client not being available on v2.3000?

A new pull request to the moduleRaid has been submitted and it must solve the issue with new version, take a look

https://github.com/wwebjs/moduleRaid/pull/1

MoudiZd commented 3 months ago

ModuleError: Requiring module "%s" with unresolved dependencies: %s

Getting this error

The reason of this error is that requiring modules is not wrapped within a try catch block, which generate a lot of errors

Also the error guard must be skipped temporarily while requiring modules as modules map contains a lot of modules that cannot and might not be required.

Anyway a new pull request to the moduleRaid has been submitted, you can check it here

https://github.com/wwebjs/moduleRaid/pull/1

MoudiZd commented 3 months ago

Still receiving this error

Error: Evaluation failed: TypeError: Cannot read properties of undefined (reading 'push')
    at fillModuleArray (eval at <anonymous> (:2:5), <anonymous>:6:74)
    at moduleRaid (eval at <anonymous> (:2:5), <anonymous>:15:3)
    at __puppeteer_evaluation_script__:4:17
    at ExecutionContext._evaluateInternal (/home/whatsapp/whatsapp/node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:221:19)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async ExecutionContext.evaluate (/home/whatsapp/whatsapp/node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:110:16)
    at async Client.initialize (/home/whatsapp/whatsapp/src/Client.js:339:9)

any solutions?

this not working

The default property is no longer existing in modules, so a workaround has been suggested in following pull request

https://github.com/wwebjs/moduleRaid/pull/1

andrew-quicklution commented 3 months ago

Thanks for the module Raid update. It worked for me.

Now it seems that we cannot send attachment because the createFromData function is not available in v2.3000. Can you confirm this?

https://github.com/pedroslopez/whatsapp-web.js/blob/72a18816a921bf0cc762cd805cc1141d22711d3c/src/util/Injected.js#L26 https://github.com/pedroslopez/whatsapp-web.js/blob/72a18816a921bf0cc762cd805cc1141d22711d3c/src/util/Injected.js#L469

StiflerPasha commented 3 months ago

I can't get the module (with .default) at all. Use "new moduleRaid" Снимок экрана 2024-03-19 130318

maunklana commented 3 months ago

Check this PR 2825

Thanks for the module Raid update. It worked for me.

Now it seems that we cannot send attachment because the createFromData function is not available in v2.3000. Can you confirm this?

https://github.com/pedroslopez/whatsapp-web.js/blob/72a18816a921bf0cc762cd805cc1141d22711d3c/src/util/Injected.js#L26 https://github.com/pedroslopez/whatsapp-web.js/blob/72a18816a921bf0cc762cd805cc1141d22711d3c/src/util/Injected.js#L469

maunklana commented 3 months ago

is has change on structure, please check this PR 2825

I can't get the module (with .default) at all. Use "new moduleRaid" Снимок экрана 2024-03-19 130318

anthonyvictor commented 3 months ago

Same error here

codeclass commented 3 months ago

wwebjs/moduleRaid#1

Thanks When I updated the moduleRaid, I started getting this error

Error: Evaluation failed: TypeError: Cannot read properties of undefined (reading 'default')
    at __puppeteer_evaluation_script__:5:95
    at ExecutionContext._evaluateInternal (/home/whatsapp/whatsapp/node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:221:19)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async ExecutionContext.evaluate (/home/whatsapp/whatsapp/node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:110:16)
    at async Client.initialize (/home/whatsapp/whatsapp/src/Client.js:339:9)

Then I updated the file Injected.js from the https://github.com/pedroslopez/whatsapp-web.js/pull/2825 and everything worked

maggnetz commented 3 months ago

in V2.3, when trying to send a message with error 'window.Store.MsgKey is not a constructor' any idea how to solve it? have you succeeded sending text message in V2.3?

mouhammad-zd commented 3 months ago

wwebjs/moduleRaid#1

Thanks When I updated the moduleRaid, I started getting this error

Error: Evaluation failed: TypeError: Cannot read properties of undefined (reading 'default')
    at __puppeteer_evaluation_script__:5:95
    at ExecutionContext._evaluateInternal (/home/whatsapp/whatsapp/node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:221:19)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async ExecutionContext.evaluate (/home/whatsapp/whatsapp/node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:110:16)
    at async Client.initialize (/home/whatsapp/whatsapp/src/Client.js:339:9)

Then I updated the file Injected.js from the #2825 and everything worked

This pr : https://github.com/wwebjs/moduleRaid/pull/1

has been created in order to not be obligated to change anything in injected.js, but as this pr has been created : https://github.com/pedroslopez/whatsapp-web.js/pull/2825

So the mentioned pr is not necessary anymore and i will close it

Dr-Horse commented 3 months ago

in V2.3, when trying to send a message with error 'window.Store.MsgKey is not a constructor' any idea how to solve it? have you succeeded sending text message in V2.3?

Same error here

willdotcom commented 3 months ago

Hello! i have this problem, anyone have how solve ?

image

MoudiZd commented 3 months ago

Hello! i have this problem, anyone have how solve ?

image

It seems that you are trying to send a message to a contact which is not found within your chat list , can you confirm ?

willdotcom commented 3 months ago

¡Hola! Tengo este problema, ¿alguien tiene cómo solucionarlo? imagen

Parece que está intentando enviar un mensaje a un contacto que no se encuentra dentro de su lista de chat, ¿puede confirmar?

Hello @MoudiZd No, the error appears after I scan the number to authenticate, which does not allow me to use it

YisusCore commented 3 months ago

Hi, I found a temporary solution .

The error

Error: Evaluation failed: TypeError: Cannot read properties of undefined (reading 'push')
    at fillModuleArray (eval at <anonymous> (:2:5), <anonymous>:6:74)
    at moduleRaid (eval at <anonymous> (:2:5), <anonymous>:15:3)
    at __puppeteer_evaluation_script__:4:17
    at ExecutionContext._evaluateInternal (/.../node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:221:19)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async ExecutionContext.evaluate (/.../node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:110:16)
    at async Client.initialize (/.../node_modules/whatsapp-web.js/src/Client.js:340:3)

at src/Client.js #339

await page.evaluate(ExposeStore, moduleRaid.toString());

.

The source code of WA is different when the browser is reloaded an there is a session. The new version 2.3.x.x set a cookie wa_build and these make the source code changes. ( @micmil1977 said it )

The solution is remove the cookie always. If the cookie was present when the puppeteer was loaded the page, delete cookie and reload it

The code:

await page.deleteCookie({name:'wa_build', domain:'.web.whatsapp.com', path:'/'});

I put it in all places i can because i don't know when the cookie is established.

MoudiZd commented 3 months ago

¡Hola! Tengo este problema, ¿alguien tiene cómo solucionarlo? imagen

Parece que está intentando enviar un mensaje a un contacto que no se encuentra dentro de su lista de chat, ¿puede confirmar?

Hello @MoudiZd No, the error appears after I scan the number to authenticate, which does not allow me to use it

Are you listening to any event related to reading messages? If yes, try to stop listening and check if it works

Actually many modules are changed and we need time to test everything to keep everything work on both versions

willdotcom commented 3 months ago

Hello @MoudiZd Thanks again for your response ❤️

Hello, no I really don't have anything listening or reading the messages, basically I just send messages, but this error occurs under these circumstances.

It is quite strange and I don't know where the problem could come from or what the temporary fix would be.

ozkanydin commented 3 months ago

Hi, I found a temporary solution .

The error

Error: Evaluation failed: TypeError: Cannot read properties of undefined (reading 'push')
    at fillModuleArray (eval at <anonymous> (:2:5), <anonymous>:6:74)
    at moduleRaid (eval at <anonymous> (:2:5), <anonymous>:15:3)
    at __puppeteer_evaluation_script__:4:17
    at ExecutionContext._evaluateInternal (/.../node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:221:19)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async ExecutionContext.evaluate (/.../node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:110:16)
    at async Client.initialize (/.../node_modules/whatsapp-web.js/src/Client.js:340:3)

at src/Client.js #339

await page.evaluate(ExposeStore, moduleRaid.toString());

.

The source code of WA is different when the browser is reloaded an there is a session. The new version 2.3.x.x set a cookie wa_build and these make the source code changes. ( @micmil1977 said it )

The solution is remove the cookie always. If the cookie was present when the puppeteer was loaded the page, delete cookie and reload it

The code:

await page.deleteCookie({name:'wa_build', domain:'.web.whatsapp.com', path:'/'});

I put it in all places i can because i don't know when the cookie is established.

Can you explain in a little more detail?

@pedroslopez We need your help, the problem persists

MoudiZd commented 3 months ago

Hello @MoudiZd Thanks again for your response ❤️

Hello, no I really don't have anything listening or reading the messages, basically I just send messages, but this error occurs under these circumstances.

  • Add the number and try to scan the QR
  • Sometimes the QR code does not generate the crash, but when you disconnect the number it does.

It is quite strange and I don't know where the problem could come from or what the temporary fix would be.

You are welcome 🤗

As we see in the picture and from the exception, that the error occured from downloadMedia method that is found within Message.js under src/structures/Message.js

Actually this method is used to download media from received messages

For that i assume that you are listening to received messages, so when you scan the qrcode and the number start receiving unread messages, i assume that it encounters some media messages, and for that sometimes the number crashes (when there is some media messages that cannot be downloaded) not all the times

But we need more tests to confirm this.

Actually we are in a weird place now and many things has been changed, it is not about just changing from webpack to comet, but really i think that whatsapp has restructured their modules, i think that things will go clearer in next hours

MoudiZd commented 3 months ago

Hi, I found a temporary solution . The error

Error: Evaluation failed: TypeError: Cannot read properties of undefined (reading 'push')
    at fillModuleArray (eval at <anonymous> (:2:5), <anonymous>:6:74)
    at moduleRaid (eval at <anonymous> (:2:5), <anonymous>:15:3)
    at __puppeteer_evaluation_script__:4:17
    at ExecutionContext._evaluateInternal (/.../node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:221:19)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async ExecutionContext.evaluate (/.../node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:110:16)
    at async Client.initialize (/.../node_modules/whatsapp-web.js/src/Client.js:340:3)

at src/Client.js #339

await page.evaluate(ExposeStore, moduleRaid.toString());

. The source code of WA is different when the browser is reloaded an there is a session. The new version 2.3.x.x set a cookie wa_build and these make the source code changes. ( @micmil1977 said it ) The solution is remove the cookie always. If the cookie was present when the puppeteer was loaded the page, delete cookie and reload it The code:

await page.deleteCookie({name:'wa_build', domain:'.web.whatsapp.com', path:'/'});

I put it in all places i can because i don't know when the cookie is established.

Can you explain in a little more detail?

@pedroslopez We need your help, the problem persists

Before anything, which wweb repo you are using? and therefore which moduleRaid version , also which web whatsapp version?

The main branch of this repo, still just supporting web whatsapp version < 2.3 and does not work with new web whatsapp version

For the new web whatsapp version, maybe you can try the webpack-exodus branch, which has changed the moduleRaid version, that has been used in order to support comet which is used now instead of webpack,

also you may use this pr: https://github.com/pedroslopez/whatsapp-web.js/pull/2825#issue-2194066644

As it is working on changing the way that we search about modules, because as i mentioned in my recent reply, that whatsapp is going to restructuring their modules, and we are not just in front of changing bundler from webpack to comet

Anyway keep your eyes on prs and issues , next hours sure will carry more improvements and more fixes

YisusCore commented 3 months ago

Hi, I found a temporary solution . The error

Error: Evaluation failed: TypeError: Cannot read properties of undefined (reading 'push')
    at fillModuleArray (eval at <anonymous> (:2:5), <anonymous>:6:74)
    at moduleRaid (eval at <anonymous> (:2:5), <anonymous>:15:3)
    at __puppeteer_evaluation_script__:4:17
    at ExecutionContext._evaluateInternal (/.../node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:221:19)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async ExecutionContext.evaluate (/.../node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:110:16)
    at async Client.initialize (/.../node_modules/whatsapp-web.js/src/Client.js:340:3)

at src/Client.js #339

await page.evaluate(ExposeStore, moduleRaid.toString());

. The source code of WA is different when the browser is reloaded an there is a session. The new version 2.3.x.x set a cookie wa_build and these make the source code changes. ( @micmil1977 said it ) The solution is remove the cookie always. If the cookie was present when the puppeteer was loaded the page, delete cookie and reload it The code:

await page.deleteCookie({name:'wa_build', domain:'.web.whatsapp.com', path:'/'});

I put it in all places i can because i don't know when the cookie is established.

Can you explain in a little more detail?

@pedroslopez We need your help, the problem persists

The cookie make the source of the web changes:

the-cookie

The new source code with cookie

with-cookie

The old source code was loaded if the cookie is not present

without-cookie

I notice the cookie was setted after the auth is ready so i put the code:

class LocalAuth extends BaseAuthStrategy {
    ...
    async afterAuthReady() {
        const page = this.client.pupPage;
        await page.deleteCookie({name:'wa_build', domain:'.web.whatsapp.com', path:'/'});
    }
    ...
}

If the cookie is present in the line 339 on src/Client.js

image

I suggest execute the code and reload the Client.

await page.deleteCookie({name:'wa_build', domain:'.web.whatsapp.com', path:'/'});

Psdt: I used the commit 1.23.1-alpha.5

MoudiZd commented 3 months ago

Hi, I found a temporary solution . The error

Error: Evaluation failed: TypeError: Cannot read properties of undefined (reading 'push')
    at fillModuleArray (eval at <anonymous> (:2:5), <anonymous>:6:74)
    at moduleRaid (eval at <anonymous> (:2:5), <anonymous>:15:3)
    at __puppeteer_evaluation_script__:4:17
    at ExecutionContext._evaluateInternal (/.../node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:221:19)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async ExecutionContext.evaluate (/.../node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:110:16)
    at async Client.initialize (/.../node_modules/whatsapp-web.js/src/Client.js:340:3)

at src/Client.js #339

await page.evaluate(ExposeStore, moduleRaid.toString());

. The source code of WA is different when the browser is reloaded an there is a session. The new version 2.3.x.x set a cookie wa_build and these make the source code changes. ( @micmil1977 said it ) The solution is remove the cookie always. If the cookie was present when the puppeteer was loaded the page, delete cookie and reload it The code:

await page.deleteCookie({name:'wa_build', domain:'.web.whatsapp.com', path:'/'});

I put it in all places i can because i don't know when the cookie is established.

Can you explain in a little more detail? @pedroslopez We need your help, the problem persists

The cookie make the source of the web changes:

the-cookie

The new source code with cookie

with-cookie

The old source code was loaded if the cookie is not present

without-cookie

I notice the cookie was setted after the auth is ready so i put the code:

class LocalAuth extends BaseAuthStrategy {
    ...
    async afterAuthReady() {
        const page = this.client.pupPage;
        await page.deleteCookie({name:'wa_build', domain:'.web.whatsapp.com', path:'/'});
    }
    ...
}

If the cookie is present in the line 339 on src/Client.js

image

I suggest execute the code and reload the Client.

await page.deleteCookie({name:'wa_build', domain:'.web.whatsapp.com', path:'/'});

Psdt: I used the commit 1.23.1-alpha.5

I do not suggest this method, as maybe whatsapp can detect that same client is going in a short way from old to new version and vice versa and this may lead to some bad classifications,

I prefer to work on supporting new version instead of keep running away from it