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

Cannot read properties of undefined (reading 'queryExists') #1313

Closed
1 task done
Eonus21 opened this issue Mar 9, 2022 · 44 comments
Closed
1 task done

Cannot read properties of undefined (reading 'queryExists') #1313

Eonus21 opened this issue Mar 9, 2022 · 44 comments
Labels
bug Something isn't working

Comments

@Eonus21
Copy link

Eonus21 commented Mar 9, 2022

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

Evaluation failed: TypeError: Cannot read properties of undefined (reading 'queryExists') with beta enabled.

Expected behavior

As a user, I expect to receive authendithicated event after code scanning, not an error

Steps to Reproduce the Bug or Issue

  1. Start client with LocalAuthStrategy
  2. Scan QR
  3. Receive such error

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

whatsapp-web v1.16.4-alpha.0

Additional context

No response

@Eonus21 Eonus21 added the bug Something isn't working label Mar 9, 2022
@Eonus21
Copy link
Author

Eonus21 commented Mar 9, 2022

Also detected this problem without multidevice enabled

@Eonus21
Copy link
Author

Eonus21 commented Mar 9, 2022

image

This can be used as quick fix, but it can broke getNumberId() function

@gg3083
Copy link

gg3083 commented Mar 9, 2022

same error, but i uesd getNumberId!

@navneetnis1
Copy link

navneetnis1 commented Mar 9, 2022

+1 I am facing same issue.

@guicuton
Copy link
Contributor

guicuton commented Mar 9, 2022

If you're on MD you shoudn't use the LegacySessionAuth.

Use LocalAuth or noAuth instead.

@gg3083
Copy link

gg3083 commented Mar 9, 2022

LocalAuth

I used LocalAuth

@guicuton
Copy link
Contributor

guicuton commented Mar 9, 2022

I''ve made some new tests and i'm getting the same issue while using the latest modifications pushed here → 2718c13

Error:
Evaluation failed: TypeError: Cannot read property 'queryExists' of undefined at __puppeteer_evaluation_script__:26:69

@guicuton
Copy link
Contributor

guicuton commented Mar 9, 2022

I''ve made some new tests and i'm getting the same issue while using the latest modifications pushed here → 2718c13

Error: Evaluation failed: TypeError: Cannot read property 'queryExists' of undefined at __puppeteer_evaluation_script__:26:69

This here working on WWEBVERSION: 2.2208.7
After update to this branch, remember to delete the .wwebjs_auth before to start your app.

@Eonus21
Copy link
Author

Eonus21 commented Mar 9, 2022

I''ve made some new tests and i'm getting the same issue while using the latest modifications pushed here → 2718c13
Error: Evaluation failed: TypeError: Cannot read property 'queryExists' of undefined at __puppeteer_evaluation_script__:26:69

This here working on WWEBVERSION: 2.2208.7 After update to this branch, remember to delete the .wwebjs_auth before to start your app.

So it starts working after rescan?

@Eonus21
Copy link
Author

Eonus21 commented Mar 9, 2022

Because I start to receive new error on message sending #1317

@dardar1129
Copy link

image

This can be used as quick fix, but it can broke getNumberId() function

After implementing this I am getting this error
(node:9544) UnhandledPromiseRejectionWarning: Error: Evaluation failed: TypeError: Cannot read properties of undefined (reading 'queryExists')

@sciapuscio
Copy link

Same issue... is not working

@jbmchd
Copy link

jbmchd commented Mar 9, 2022

same issue

@janke184
Copy link

janke184 commented Mar 9, 2022

Same here using LocalAuth :(

@jonasschen
Copy link

Same here. Using multidevice branch

@sidikhanrei
Copy link

Try my temporary fix.
It will use old queryExists function if client not updated.

Client.js Line 944

async getNumberId(number) {
        if (!number.endsWith('@c.us')) {
            number += '@c.us';
        }
        return await this.pupPage.evaluate(async number => {
            try {

                const result = await window.Store.QueryExist(number);
                if (!result || result.wid === undefined) return null;
                return result.wid;

            } catch(err){

                let result = await window.Store.Wap.queryExist(number);
                if (result.jid === undefined)
                    throw 'The number provided is not a registered whatsapp user';
                return result.jid;
            }
        }, number);
    }

@sciapuscio
Copy link

Worked for me... ! =D temporary fix works well. Thanks @sidikhanrei

@sciapuscio
Copy link

It connects fine but then it doesn't send the messages. There is no log record.

@sidikhanrei
Copy link

use this release version https://www.npmjs.com/package/whatsapp-web.js/v/1.16.4-alpha.0
and replace the Client with temporary fix

@sciapuscio
Copy link

sciapuscio commented Mar 9, 2022

Using 1.16.4-alpha.0
I closed and opened the console and again "Evaluation failed: TypeError: Cannot read properties of undefined (reading 'query Exists')" =(... Something bad is happening here.

Another symptom, the session folder is always left empty.

@cristovammartins
Copy link

Sessão não estava salvando tbm

@sciapuscio
Copy link

sometimes connect. When it does it appears to work but in reality the session folder is empty and the messages don't come out.

CHECKED

@elhumbertoz
Copy link
Contributor

I have the same error.!

@kikemarto
Copy link

I have devices with the problem and another devices without it, it's very strange.

@sciapuscio
Copy link

@kikemarto Me too... two services on the same OS... one is working I WILL TRY TO NEVER CLOSE IT an the other service is just DEAD

@kikemarto
Copy link

The services that works I can restart without problems and works continue.

@sciapuscio
Copy link

spooky 🥴🥴

@CValeron
Copy link

CValeron commented Mar 9, 2022

same issue :(

@dardar1129
Copy link

on restarting the service, it sends the message for the first time. and then shows the error.

(node:25012) UnhandledPromiseRejectionWarning: Error: Evaluation failed: TypeError: Cannot read properties of undefined (reading 'queryExists')

This is something strange, please fix this asap.
There is no stable version too, I am getting errors on 4 previous versions.

@josuelmm
Copy link

josuelmm commented Mar 9, 2022

Same error but Error: Evaluation failed: TypeError: Cannot read properties of undefined (reading 'cast')

(node:34196) UnhandledPromiseRejectionWarning: Error: Evaluation failed: TypeError: Cannot read properties of undefined (reading 'cast')
at m._basicSend (https://web.whatsapp.com/bootstrap_qr.79aba964bea38dbcc501.js:65:676297)
at m.phoneTimedOut (https://web.whatsapp.com/bootstrap_qr.79aba964bea38dbcc501.js:65:675603)
at m.s (https://web.whatsapp.com/bootstrap_qr.79aba964bea38dbcc501.js:70:10060)
at https://web.whatsapp.com/bootstrap_qr.79aba964bea38dbcc501.js:70:9056
at t.ShiftTimer._run (https://web.whatsapp.com/bootstrap_qr.79aba964bea38dbcc501.js:5:340486)
at t.ShiftTimer.forceRunNow (https://web.whatsapp.com/bootstrap_qr.79aba964bea38dbcc501.js:5:340827)
at puppeteer_evaluation_script:2:60
at ExecutionContext._evaluateInternal (D:\xampp\htdocs\WhatsApp\node_modules\puppeteer\lib\cjs\puppeteer\common\ExecutionContext.js:221:19)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async ExecutionContext.evaluate (D:\xampp\htdocs\WhatsApp\node_modules\puppeteer\lib\cjs\puppeteer\common\ExecutionContext.js:110:16)
at async Client.resetState (D:\xampp\htdocs\WhatsApp\node_modules\whatsapp-web.js\src\Client.js:924:9)
(Use node --trace-warnings ... to show where the warning was created)
(node:34196) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:34196) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

@sciapuscio
Copy link

We need you @pedroslopez !!!! =(

@pedroslopez
Copy link
Owner

This issue was happening because WhatsApp Web was sometimes serving up v2.2206.9 and then updating it to v2.2208.7 in some cases. Now that 2.2208.7 seems to be the only version getting served, I released v1.16.4 of the library to address this. Please update and this shouldn't be happening anymore.

@dardar1129
Copy link

This issue was happening because WhatsApp Web was sometimes serving up v2.2206.9 and then updating it to v2.2208.7 in some cases. Now that 2.2208.7 seems to be the only version getting served, I released v1.16.4 of the library to address this. Please update and this shouldn't be happening anymore.

Hey Thanks a lot @pedroslopez
I updated to v1.16.4 and it seems to work perfectly as of now.

@Eonus21
Copy link
Author

Eonus21 commented Mar 10, 2022

Fixed in v1.16.4

@Eonus21 Eonus21 closed this as completed Mar 10, 2022
@herduin
Copy link

herduin commented Mar 10, 2022

I have this problem in v1.16.4 in Non-MD session. Any idea?

@whizydev
Copy link

whizydev commented Mar 23, 2022

Updated to latest version. This error happens to me since today. Before it worked well.

@priti0802
Copy link

priti0802 commented Apr 6, 2022

Updated to latest version. This error happens to me since today. Before it worked well.

SAME I AM NOT ABLE TO FIX THE ISSUES

[Cannot read properties of undefined (reading 'queryExists')..

PLZ HELP FOR THE SAME

@ghost
Copy link

ghost commented Feb 9, 2023

erro: Cannot read properties of undefined (reading 'queryExists')

hey guys.
it worked for me to delete the '.wwebjs_auth' folder and reconnect generating a new QRCODE.

@willkuerlich
Copy link

willkuerlich commented Feb 10, 2023

erro: Cannot read properties of undefined (reading 'queryExists')

hey guys. it worked for me to delete the '.wwebjs_auth' folder and reconnect generating a new QRCODE.

I am getting the same error, from this day on. Bot has been working for several weeks without any issues. After authenticating with qr via localAuth strategy, this error is thrown.
Even with deleting the ".wwebjs_auth" directory in advance.

\node_modules\whatsapp-web.js\node_modules\puppeteer\lib\cjs\puppeteer\common\ExecutionContext.js:221
throw new Error('Evaluation failed: ' + helper_js_1.helper.getExceptionMessage(exceptionDetails));
Error: Evaluation failed: TypeError: Cannot read properties of undefined (reading 'queryExists')
    at __puppeteer_evaluation_script__:25:69
at ExecutionContext._evaluateInternal ...

Tried with whatsapp-web version 1.19.3 and 1.19.1

Is the dependency on puppeteer version 13.0.0 correct?

@jauharitontowi
Copy link

i have the same error

@willkuerlich
Copy link

Maybe Whatsapp changed the DOM structure of their html page?

@willkuerlich
Copy link

willkuerlich commented Feb 10, 2023

@pedroslopez Would you mind to have a look?

In my case it is currently really annoying to run my dev environment, since every app restart means now to have to scan the qr code every time :*(

Update: tofers#2 Fixes it! 🚀🚀🚀

@DiegoDelBianco
Copy link

@pedroslopez Would you mind to have a look?

In my case it is currently really annoying to run my dev environment, since every app restart means now to have to scan the qr code every time :*(

Update: tofers#2 Fixes it! rocketrocketrocket

Great!

I replace the line 28 of file src/util/Injected.js to:
window.Store.QueryExist = window.mR.findModule('queryExist')[0].queryWidExists;

And work to me now, thanks

@borjaom23
Copy link

Using 1.19.5
Same issue... is not working
We need you @pedroslopez !!

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

No branches or pull requests