Wa-automate-nodejs: Error thrown when executing getGroupMemebers

Created on 30 Mar 2020  Â·  5Comments  Â·  Source: open-wa/wa-automate-nodejs

Describe the bug
An error is thrown when trying to use getGroupMemebers function:

Error: Evaluation failed: TypeError: output.update is not a function
    at Object.window.WAPI.getGroupMetadata (/node_modules/sulla-hotfix/dist/lib/wapi.js:633:26)
    at Object.window.WAPI._getGroupParticipants (/node_modules/sulla-hotfix/dist/lib/wapi.js:651:33)
    at Object.window.WAPI.getGroupParticipantIDs (/node_modules/sulla-hotfix/dist/lib/wapi.js:663:32)
    at __puppeteer_evaluation_script__:1:35
    at ExecutionContext._evaluateInternal (/node_modules/puppeteer/lib/ExecutionContext.js:122:13)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async ExecutionContext.evaluate (/node_modules/puppeteer/lib/ExecutionContext.js:48:12)
  -- ASYNC --
    at ExecutionContext.<anonymous> (/node_modules/puppeteer/lib/helper.js:111:15)
    at DOMWorld.evaluate (/node_modules/puppeteer/lib/DOMWorld.js:112:20)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
  -- ASYNC --
    at Frame.<anonymous> (/node_modules/puppeteer/lib/helper.js:111:15)
    at Page.evaluate (/node_modules/puppeteer/lib/Page.js:860:43)
    at Page.<anonymous> (/node_modules/puppeteer/lib/helper.js:112:23)
    at Whatsapp.<anonymous> (/node_modules/sulla-hotfix/dist/api/whatsapp.js:560:50)
    at step (/node_modules/sulla-hotfix/dist/api/whatsapp.js:33:23)
    at Object.next (/node_modules/sulla-hotfix/dist/api/whatsapp.js:14:53)
    at /node_modules/sulla-hotfix/dist/api/whatsapp.js:8:71
    at new Promise (<anonymous>)
    at __awaiter (/node_modules/sulla-hotfix/dist/api/whatsapp.js:4:12)
    at Whatsapp.getGroupMembersId (/node_modules/sulla-hotfix/dist/api/whatsapp.js:557:16)
    at Whatsapp.<anonymous> (/node_modules/sulla-hotfix/dist/api/whatsapp.js:582:45)
    at step (/node_modules/sulla-hotfix/dist/api/whatsapp.js:33:23)
    at Object.next (/node_modules/sulla-hotfix/dist/api/whatsapp.js:14:53)
    at /node_modules/sulla-hotfix/dist/api/whatsapp.js:8:71
    at new Promise (<anonymous>)
    at __awaiter (/node_modules/sulla-hotfix/dist/api/whatsapp.js:4:12)
    at Whatsapp.getGroupMembers (/node_modules/sulla-hotfix/dist/api/whatsapp.js:577:16)
    at start (/index.js:62:32)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async main (/home/ec2-user/corona-bot/index.js:259:5)

Steps to Reproduce
Steps to reproduce the behavior:

  1. use create() code
  2. add a function called start:
async function start(bot) {
  let groups = [];
  try {
    groups = await bot.getAllGroups();
  } catch (e) {
    console.error(e);
    return;
  }

  groups = groups.filter(({ isReadOnly }) => isReadOnly === false);
  for (const group of groups) {
    const contacts = await bot.getGroupMembers(group.id._serialized);
  }
}

create() code
This is the code you use to create the client. e.g

async function main() {
  let bot;
  try {
    bot = await sulla.create();
  } catch (e) {
    console.error(e);
    return;
  }

  try {
    await start(bot);
  } catch (e) {
    console.error(e);
  }
}

main();

Expected behavior
A list of group members would be returned.

DEBUG INFO
This is the info printed to the console when you start your app. It should look like this

Debug Info {
  WA_VERSION: '0.4.2081',
  PAGE_UA: 'WhatsApp/0.4.613 Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) A
ppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36',
  SULLA_HOTFIX_VERSION: '1.8.26',
  BROWSER_VERSION: 'HeadlessChrome/80.0.3987.0'
}

Screenshots

Host (please complete the following information):

  • OS: Android

Additional context

bug

All 5 comments

thanks @yoavmmn for bringing this up. It's an issue with wapi.js on the new version of whatsapp web.

@github-actions run


âš¡ Release! âš¡

(async () => {
function exec(cmd) {
  console.log(execSync(cmd).toString());
}

// Config
const gitUserEmail = "github-actions[bot]@users.noreply.github.com";
const gitUserName = "github-actions[bot]";

exec(`echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc`);
exec(`git config --global user.email "${gitUserEmail}"`);
exec(`git config --global user.name "${gitUserName}"`);
exec(`npm i`);
exec(`npm run release-ci`);

var result = execSync(`npx auto-changelog -o ./tempchangelog.txt --commit-limit false --template ./compact-keepachangelog.hbs --stdout`).toString();

    await postComment(result);
  })();

Changelog

🚀 Release 1.8.27 (2020-03-30)

  • Bump eventemitter2 from 6.2.1 to 6.3.1 #249
  • Bump release-it from 13.3.2 to 13.5.0 #250
  • Bump @types/node from 13.9.4 to 13.9.5 #251
  • Release 1.8.27 298962a
  • replaced update procedure with GroupMetadata.find(...). fix for #252 2241152

@yoavmmn try the new version and report back if the fix worked for you. thanks

It seems to be solved. thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

scoorpionx picture scoorpionx  Â·  7Comments

DeLuca92 picture DeLuca92  Â·  5Comments

mrbarnk picture mrbarnk  Â·  5Comments

vsilva472 picture vsilva472  Â·  4Comments

jazZcarabazZ picture jazZcarabazZ  Â·  5Comments