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.62k stars 3.48k forks source link

Cannot read properties of undefined (reading 'getChats') #1388

Closed luiscuriel closed 11 months ago

luiscuriel commented 2 years ago

Is there an existing issue for this?

Describe the bug

I am getting this error ocasionally when calling client.getChats:

Cannot read properties of undefined (reading 'getChats')

image

Expected behavior

no error

Steps to Reproduce the Bug or Issue

call getChats often

Relevant Code

No response

Browser Type

Chromium

WhatsApp Account Type

WhatsApp Business

Does your WhatsApp account have multidevice enabled?

Yes, I am using Multi Device

Environment

node 16.14.0

Additional context

No response

N-D-P commented 2 years ago

Hello, I was getting same error, but it got resolved, I was keeping headless : true, that's why it was giving me this error, After making it false, and scanning the qrcode in chrominum it got resolved.

If you wish to keep headless : true, there's a workaround, keep it false for the first time, and ones it is authorized, you can turn it to true.