Issue Description
Seems like #201680 broke the client.getContacts() method.
Instead of returning a list of objects, it now returns a list of promises that are not mapped onto the appropriate object.
If I change locally Client.js to have
/**
* Get all current contact instances
* @returns {Promise<Array<Contact>>}
*/
async getContacts() {
let contacts = await this.pupPage.evaluate(() => {
const promises = window.WWebJS.getContacts();
return Promise.allSettled(promises);
});
return contacts
.filter((res => res.status === 'fulfilled'))
.map((res) => res.value)
.map((contact) => ContactFactory.create(this, contact));
}
then the client.getContacts() method returns contacts properly again.
Or maybe the typings didn't get changed accordingly to Promise<Array<Promise<Contact>>>.
Reproduction Steps
- Use the lib from the main branch
- Call
await client.getContacts()
- Observe result
Code Sample
const { Client } = require('whatsapp-web.js');
const qrcode = require('qrcode-terminal');
const client = new Client();
client.on('qr', (qr) => {
qrcode.generate(qr, { small: true });
});
client.on('ready', () => {
console.log('Client is ready!');
const contacts = await this.client.getContacts();
console.log(contacts);
});
client.initialize();
User Setup
| WhatsApp |
Type |
| Account Type |
Standard |
| Authentication Strategy |
LocalAuth |
| WhatsApp Web Version |
2.3000.1036609119 |
| whatsapp-web.js Version |
main - 1a9a1b7 |
| Environment |
Version |
| Browser Type |
Google Chrome |
| Browser Version |
146.0.7680.178 |
| Phone OS Version |
ios 26.4 |
| Running OS Version |
Windows 11 |
| Node.js Version |
25.9.0 |
Checklist
Issue Description
Seems like #201680 broke the client.getContacts() method.
Instead of returning a list of objects, it now returns a list of promises that are not mapped onto the appropriate object.
If I change locally
Client.jsto havethen the
client.getContacts()method returns contacts properly again.Or maybe the typings didn't get changed accordingly to
Promise<Array<Promise<Contact>>>.Reproduction Steps
await client.getContacts()Code Sample
User Setup
Checklist