Wa-automate-nodejs: Main code doesn't generate QR Code.

Created on 12 Mar 2020  Â·  7Comments  Â·  Source: open-wa/wa-automate-nodejs

Describe the bug
Can't start sulla with the example code on Readme.

Steps to Reproduce
Steps to reproduce the behavior:

  1. Create a new paste.
  2. Open the folder on terminal.
  3. "npm init -y"
  4. "npm i --save sulla-hotfix"
  5. Create a javascript file and paste the example code on Readme.
  6. Open the paste on terminal again
  7. "node start.js"(start.js its the file that the code is.)

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

const sulla = require('sulla-hotfix');

sulla.create().then(client => start(client));

function start(client) {
    client.onMessage(message => {
        if (message.body === 'Hi') {
            client.sendText(message.from, '👋 Hello from sulla!');
        }
    });
}

Expected behavior
I was expecting the regular result, that the code generate the QR code.

DEBUG INFO

node start.js 
â ¸ Initializing whatsapp(node:30455) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'sessionData' of undefined
    at Object.<anonymous> (/home/dr4gon/Desktop/chatbot/node_modules/sulla-hotfix/dist/controllers/browser.js:115:59)
    at step (/home/dr4gon/Desktop/chatbot/node_modules/sulla-hotfix/dist/controllers/browser.js:44:23)
    at Object.next (/home/dr4gon/Desktop/chatbot/node_modules/sulla-hotfix/dist/controllers/browser.js:25:53)
    at fulfilled (/home/dr4gon/Desktop/chatbot/node_modules/sulla-hotfix/dist/controllers/browser.js:16:58)
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:30455) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:30455) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
â ¼ Initializing whatsapp

Debug Info {
  WA_VERSION: ...,
  PAGE_UA: ...,
  SULLA_HOTFIX_VERSION: 1.8.18,
  BROWSER_VERSION: Google Chrome Version 80.0.3987.132 (Official Build) (64-bit) STANDARD BROWSER
Chromium Version 80.0.3987.132 (Official Build) snap (64-bit)
Firefox 74.0 (64-bit) 
}

Screenshots
none

Host (please complete the following information):

  • OS: Ubuntu 19.10

Additional context
package.json

{
  "name": "chatbot",
  "version": "1.0.0",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "description": "",
  "dependencies": {
    "sharp": "^0.25.1",
    "sulla-hotfix": "^1.8.18"
  }
}
bug

All 7 comments

@scoorpionx thanks for filling the template properly.

I can see the problem and will issue a fix soon. In the meantime can you try this:

...
sulla.create('session',{})...
...

That work for me, thanks.
Can you explain to me whats causin' that and where did you find the problem?

sessionData is being checked on an undefined object.

@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.19 (2020-03-12)

  • Release 1.8.19 f7f7c3a
  • added package min node version req + badge #208 fb10a4c
  • check if puppeteerConfigOverride exists before getting sessionData #210 624da8c

@scoorpionx can you check with latest version + original set up and confirm it's working, please. thanks.

Its working.
Thanks.

Was this page helpful?
0 / 5 - 0 ratings