-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Description
Is there an existing issue for this?
- I have searched the existing issues.
Is this a problem caused by your code, or is it specifically because of the library?
- I have double-checked my code carefully.
Describe the bug.
When calling client.deleteAddressbookContact() with a phone number in plain numeric format, the method throws a TypeError attempting to read the isLid property from an undefined object.
Expected Behavior
The method should successfully delete the contact from the addressbook, or at minimum provide a clear error message if the phone number format is invalid.
Steps to Reproduce the Bug or Issue
Environment
- whatsapp-web.js version: v1.34.3 (from GitHub: github:pedroslopez/whatsapp-web.js#v1.34.3)
- Node.js version: v22.16.0
- Operating System: Windows、Linux
- Initialize a WhatsApp client using whatsapp-web.js
- Call client.deleteAddressbookContact() with a plain numeric phone number (e.g., "1234567890")
- The error occurs consistently every time
Code Example:
const client = new Client({
authStrategy: new RemoteAuth({
clientId: ${clientId},
// ... other config
})
});
await client.initialize();
// This throws an error
await client.deleteAddressbookContact("1234567890");
WhatsApp Account Type
Standard
Browser Type
Chromium
Operation System Type
Windows、Linux
Phone OS Type
IOS
WhatsApp-Web.js Version
1.34.3
WhatsApp Web Version
2.3000.1031077521
Node.js Version
v22.16.0
Authentication Strategy
RemoteAuth
Additional Context
According to the JSDoc comment in Client.js:2427, the expected phone number format is: "17182222222" (where "1" is a country code). However:
- Multiple formats tested and all fail:
- Plain numeric format: "1234567890" ❌ Fails
- WhatsApp ID format: "[email protected]" ❌ Also fails with the same error