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

Trying to remove participants throws an exception #2533

Open
1 task done
Pezmc opened this issue Sep 25, 2023 · 0 comments · May be fixed by #2531
Open
1 task done

Trying to remove participants throws an exception #2533

Pezmc opened this issue Sep 25, 2023 · 0 comments · May be fixed by #2531
Labels
bug Something isn't working

Comments

@Pezmc
Copy link

Pezmc commented Sep 25, 2023

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

When removing a user from a group, whatapp-web crashes entirely:

Previous issue: #1979

./node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:221
            throw new Error('Evaluation failed: ' + helper_js_1.helper.getExceptionMessage(exceptionDetails));
                  ^

Error: Evaluation failed: Error: expected at least 1 children, but found 0
    at i (https://web.whatsapp.com/app.896b392b51c1b38bc49c.js:5:761706)
    at t.makeRemoveParticipantsRequest (https://web.whatsapp.com/main.1865f1b812c75c8c32ca.js:2:232668)
    at https://web.whatsapp.com/main.1865f1b812c75c8c32ca.js:2:92198
    at Generator.next (<anonymous>)
    at t (https://web.whatsapp.com/vendor1~app.7f14216f970118f62a35.js:2:32250)
    at s (https://web.whatsapp.com/vendor1~app.7f14216f970118f62a35.js:2:32461)
    at https://web.whatsapp.com/vendor1~app.7f14216f970118f62a35.js:2:32520
    at new Promise (<anonymous>)
    at https://web.whatsapp.com/vendor1~app.7f14216f970118f62a35.js:2:32401
    at f (https://web.whatsapp.com/main.1865f1b812c75c8c32ca.js:2:92774)
    at ExecutionContext._evaluateInternal (/Users/pezcuckow/Git/GithubBot/node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:221:19)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async ExecutionContext.evaluate (/Users/pezcuckow/Git/GithubBot/node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:110:16)
    at async GroupChat.removeParticipants (/Users/pezcuckow/Git/GithubBot/node_modules/whatsapp-web.js/src/structures/GroupChat.js:80:16)
    at async removeUser (file:///Users/pezcuckow/Git/GithubBot/index.js:654:3)
    at async promptToRemoveUser (file:///Users/pezcuckow/Git/GithubBot/index.js:607:3)
    at async removeUsers (file:///Users/pezcuckow/Git/GithubBot/index.js:580:9)
    at async main (file:///Users/pezcuckow/Git/GithubBot/index.js:289:9)

Node.js v18.18.0

Expected behavior

It should remove the users without error, or throw an error message explaining why it cannot.

Steps to Reproduce the Bug or Issue

State: A user is a member of a community (and several sub groups).
Try to remove the user from the community using community.removeParticipants

Example code:

const community = await client.getChatById(COMMUNITY_ID)
await community.removeParticipants(["123455@c.us"])

Relevant Code

Example group object (manually sanitised):

GroupChat {
  groupMetadata: {
    id: {
      server: 'g.us',
      user: '123',
      _serialized: '123@g.us'
    },
    creation: 1675502844,
    owner: {
      server: 'c.us',
      user: '123',
      _serialized: '123@c.us'
    },
    subject: 'My Group Name',
    subjectTime: 1675506415,
    desc: 'Description is here
    descId: '1675494663-749',
    descTime: 1675520292,
    descOwner: {
      server: 'c.us',
      user: '123',
      _serialized: '123@c.us'
    },
    restrict: false,
    announce: false,
    noFrequentlyForwarded: false,
    ephemeralDuration: 0,
    membershipApprovalMode: false,
    memberAddMode: 'admin_add',
    reportToAdminMode: false,
    size: 19, // Community actually has over 500 people in
    support: false,
    suspended: false,
    terminated: false,
    uniqueShortNameMap: {},
    isLidAddressingMode: false,
    isParentGroup: true, // Definitely the community group
    isParentGroupClosed: true,
    defaultSubgroup: false,
    generalSubgroup: false,
    generalChatAutoAddDisabled: false,
    allowNonAdminSubGroupCreation: false,
    lastActivityTimestamp: 0,
    lastSeenActivityTimestamp: 0,
    incognito: false,
    // Of note: This list ONLY has the admin team in it? Not the full group participants list. Is this a possible
    participants: [
      [Object], [Object], [Object],
      [Object], [Object], [Object],
      [Object], [Object], [Object],
      [Object], [Object], [Object],
      [Object], [Object], [Object],
      [Object], [Object], [Object],
      [Object]
    ],  source of the bug?
    pendingParticipants: [],
    pastParticipants: [],
    membershipApprovalRequests: [],
    subgroupSuggestions: []
  },
  id: {
    server: 'g.us',
    user: '123',
    _serialized: '123@g.us'
  },
  name: 'My GROUP',
  isGroup: true,
  isReadOnly: false,
  unreadCount: 0,
  timestamp: 1694958023,
  archived: undefined,
  pinned: false,
  isMuted: false,
  muteExpiration: 0,
  lastMessage: undefined
}

No response

Browser Type

Chromium

WhatsApp Account Type

Standard

Does your WhatsApp account have multidevice enabled?

Yes, I am using Multi Device

Environment

OS: Mac
Phone OS: iOS
whatsapp-web.js version: Latest (git@github.com:pedroslopez/whatsapp-web.js.git#152f0a64cdffdfb4d638043f537f87b2a6ebc492)
WhatsApp Web version: 2.2340.1
Node.js Version: Node.js v18.18.0

Additional context

No response

@Pezmc Pezmc added the bug Something isn't working label Sep 25, 2023
@alechkos alechkos linked a pull request Oct 17, 2023 that will close this issue
7 tasks
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

Successfully merging a pull request may close this issue.

1 participant