Describe the bug
getAllNewMessages throws a Cannot read property '_models' of undefined error.
Steps to Reproduce
Steps to reproduce the behavior:
Error: Evaluation failed: TypeError: Cannot read property '_models' of undefined\n at /Users/sandrosalles/workspace/zappo/client/node_modules/@open-wa/wa-automate/dist/lib/wapi.js:300:113\n at Array.map (
)\n at Object.window.WAPI.getAllNewMessages (/Users/sandrosalles/workspace/zappo/client/node_modules/@open-wa/wa-automate/dist/lib/wapi.js:300:97)\n at __puppeteer_evaluation_script__:1:28\n at ExecutionContext._evaluateInternal (/Users/sandrosalles/workspace/zappo/client/node_modules/puppeteer/lib/ExecutionContext.js:102:19)\n at processTicksAndRejections (internal/process/task_queues.js:93:5)\n at async ExecutionContext.evaluate (/Users/sandrosalles/workspace/zappo/client/node_modules/puppeteer/lib/ExecutionContext.js:33:16)\n -- ASYNC --\n at ExecutionContext. (/Users/sandrosalles/workspace/zappo/client/node_modules/puppeteer/lib/helper.js:94:19)\n at DOMWorld.evaluate (/Users/sandrosalles/workspace/zappo/client/node_modules/puppeteer/lib/DOMWorld.js:89:24)\n at processTicksAndRejections (internal/process/task_queues.js:93:5)\n -- ASYNC --\n at Frame. (/Users/sandrosalles/workspace/zappo/client/node_modules/puppeteer/lib/helper.js:94:19)\n at Page.evaluate (/Users/sandrosalles/workspace/zappo/client/node_modules/puppeteer/lib/Page.js:612:14)\n at Page. (/Users/sandrosalles/workspace/zappo/client/node_modules/puppeteer/lib/helper.js:95:27)\n at Client. (/Users/sandrosalles/workspace/zappo/client/node_modules/@open-wa/wa-automate/dist/api/Client.js:1219:46)\n at step (/Users/sandrosalles/workspace/zappo/client/node_modules/@open-wa/wa-automate/dist/api/Client.js:44:23)\n at Object.next (/Users/sandrosalles/workspace/zappo/client/node_modules/@open-wa/wa-automate/dist/api/Client.js:25:53)\n at /Users/sandrosalles/workspace/zappo/client/node_modules/@open-wa/wa-automate/dist/api/Client.js:19:71\n at new Promise ( )\n at __awaiter (/Users/sandrosalles/workspace/zappo/client/node_modules/@open-wa/wa-automate/dist/api/Client.js:15:12)\n at Client.getAllNewMessages (/Users/sandrosalles/workspace/zappo/client/node_modules/@open-wa/wa-automate/dist/api/Client.js:1213:16)\n -- ASYNC --\n at Page. (/Users/sandrosalles/workspace/zappo/client/node_modules/puppeteer/lib/helper.js:94:19)\n at Client. (/Users/sandrosalles/workspace/zappo/client/node_modules/@open-wa/wa-automate/dist/api/Client.js:1219:46)\n at step (/Users/sandrosalles/workspace/zappo/client/node_modules/@open-wa/wa-automate/dist/api/Client.js:44:23)\n at Object.next (/Users/sandrosalles/workspace/zappo/client/node_modules/@open-wa/wa-automate/dist/api/Client.js:25:53)\n at /Users/sandrosalles/workspace/zappo/client/node_modules/@open-wa/wa-automate/dist/api/Client.js:19:71\n at new Promise ( )\n at __awaiter (/Users/sandrosalles/workspace/zappo/client/node_modules/@open-wa/wa-automate/dist/api/Client.js:15:12)\n at Client.getAllNewMessages (/Users/sandrosalles/workspace/zappo/client/node_modules/@open-wa/wa-automate/dist/api/Client.js:1213:16)\n at on_initialize (file:///Users/sandrosalles/workspace/zappo/client/tasks.js:188:16)\n at processTicksAndRejections (internal/process/task_queues.js:93:5)
create() code
This is the code you use to create the client. e.g
create({
sessionId: `mySessionId`,
sessionDataPath: 'sessions',
chromiumArgs,
sessionData,
headless: false,
autoRefresh: true,
blockCrashLogs: true,
cacheEnabled: true,
throwErrorOnTosBlock: true,
logConsole: false,
logConsoleErrors: true,
skipBrokenMethodsCheck: true,
useChrome: true,
qrLogSkip: true,
bypassCSP: true,
disableSpins: true,
useStealth: false,
killProcessOnBrowserClose: false,
qrTimeout: config.WA_QR_TIMEOUT,
authTimeout: config.AUTH_TIMEOUT,
proxyServerCredentials
})
.then((client) => {
...
})
Expected behavior
getAllNewMessages to actually return the new messages (if any).
DEBUG INFO
This is the info printed to the console when you start your app. It should look like this
Debug Info {
WA_VERSION: 2.2025.6,
PAGE_UA: WhatsApp/2.2019.8 Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36,
WA_AUTOMATE_VERSION: 1.9.75,
BROWSER_VERSION: Chrome/83.0.4103.106
}
Host (please complete the following information):
Regards
Thanks for reporting @sandro-salles will fix this ASAP
@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`);
//comment on the issue
var result = execSync(`npx auto-changelog -o ./tempchangelog.txt --commit-limit false --template ./compact-keepachangelog.hbs --stdout`).toString();
await postComment(result);
//create changelog image
exec(`npm run release-image`);
exec(`git commit -a -m 'updated release-image'`);
exec(`git push --force`);
})();
@sandro-salles all working now