-
-
Notifications
You must be signed in to change notification settings - Fork 188
fix(chat): avoid infinite recursion in isGroup property #3088
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
fix(chat): avoid infinite recursion in isGroup property #3088
Conversation
WhatsApp Web recently updated and broke the isGroup property getter, causing infinite recursion when accessed. This resulted in: - RangeError: Maximum call stack size exceeded - All message sending operations failing - Chat operations throwing stack overflow errors Root cause: PR wppconnect-team#3078 changed from functions.getIsGroup to chat.id.isGroup() which creates infinite recursion when accessing the property. Fix: Check chat ID format directly instead of calling chat.id.isGroup() - Group IDs end with @g.us - Contact IDs end with @c.us - Avoids the recursive property access that causes the stack overflow Tested with unminified build and verified message sending works correctly for all chat types (contacts, groups, and newsletters/channels).
|
please add here the results:
Also Which functions you are using to trigger the infinite loop |
|
Hi @manfe, I'm experiencing the exact same issue described in this PR. Here are the details you requested: Functions Triggering Infinite Loop:The infinite recursion occurs when calling:
Error Details:
Reproduction Steps:
const contact = "[email protected]";
window.WPP.chat.sendTextMessage(contact, "Test", {
createChat: true,
waitForAck: true
});Environment:WA-JS Version: 3.18.8 Impact:This completely breaks message sending functionality. All attempts to send messages fail with the stack overflow error. The fix in this PR (checking ID format directly instead of calling chat.id.isGroup()) makes perfect sense and should resolve the issue. Looking forward to this being merged! Thanks for working on this fix! |
|
Build Constants WhatsApp Web Version: 2.3000.1030354043 Functions Triggering the Infinite Loop The infinite recursion occurs when any code tries to access the isGroup property on a ChatModel instance. Here are examples:
const chat = await WPP.chat.get('[email protected]');
const chat = await WPP.chat.get('[email protected]');
const chats = await WPP.chat.list(); Root Cause The bug was introduced in PR #3078 (line 180 in src/chat/patch.ts): Before (working): After (buggy): This creates infinite recursion because:
Fix: This directly checks the ID string format, avoiding the circular dependency. |
|
@doonfrs on latest nightly version I am not able to reproduce it. WPP.chat.get("[email protected]")
{revisionNumber: 24, __x_stale: {…}, __fired: null, __changes: null, __initialized: true, …}Try with the new released version 3.19.0 |
|
@doonfrs did you have success with the new version? |
|
Not having feedback until tomorrow (27/nov) and no one else reporting issue with infinite loop I will close this issue. This should be fixed in versions |
|
No interaction, closing it |
WhatsApp Web recently updated and broke the isGroup property getter, causing infinite recursion when accessed. This resulted in:
Root cause: PR #3078 changed from functions.getIsGroup to chat.id.isGroup() which creates infinite recursion when accessing the property.
Fix: Check chat ID format directly instead of calling chat.id.isGroup()
Tested with unminified build and verified message sending works correctly for all chat types (contacts, groups, and newsletters/channels).