open-wa / wa-automate-nodejs

💬 🤖 The most reliable tool for chatbots with advanced features. Be sure to 🌟 this repository for updates!
https://docs.openwa.dev/
Other
3.12k stars 590 forks source link

Error when trying to start session #72

Closed gacalixto closed 4 years ago

gacalixto commented 4 years ago

I'm having an error when trying to start a session with sulla. (node:28945) UnhandledPromiseRejectionWarning: Error: Evaluation failed: ReferenceError: webpackJsonp is not defined This error occurs when executing index.ts and also when executing custom code that uses sulla

smashah commented 4 years ago

Duplicate #71

smashah commented 4 years ago

@gacalixto

I'm not able able to recreate this issue. Can you all please share more details:

You can find all this in the issue template.

jigipatel commented 4 years ago

in order to recreate this issue please download attached code sulla-hotfix-demo.zip

then run npm update after that run nodemon stop node server and start again or make any change in code and save

you will get this error. if we delete session folder generated at run time then it will not throw this error if you repeat same steps again you will get same error again

gacalixto commented 4 years ago

sulla version : "sulla-hotfix": "^1.6.8"

my create() code: create('session', { executablePath: '/usr/bin/google-chrome' }).then(client => start(client));

steps to recreate:

  1. Execute index.ts on demo folder and create a new session
  2. delete session folder and start again, same error

OS: Ubuntu

gnadelwartz commented 4 years ago

I have a similar problem on second start of sulla I get:

node dealwaecho.js
✔ Initializing whatsapp
ℹ Authenticate to continue
✔ Loading QR

(node:6629) UnhandledPromiseRejectionWarning: Error: Evaluation failed: ReferenceError: webpackJsonp is not defined
    at __puppeteer_evaluation_script__:3:29
    at ExecutionContext._evaluateInternal (/home/kay/telegram/newecho/node_modules/puppeteer/lib/ExecutionContext.js:122:13)
    at process._tickCallback (internal/process/next_tick.js:68:7)

When I delete session dir I can start the script, scan QR code and process messages. on second start, even if the session ist stoped by kill or CTRL-c, I got the error above. Note the Autenticate to continue, I'm already authenticated!

OS: Linux, OpenSuse 15.3 sulla: v1.6.8 node: v10.16.3

unfortunately I cannot run headless: false, because I run on a headless linux server ...

gnadelwartz commented 4 years ago

seems similar to #75

barkerpedro commented 4 years ago

Test in version 1.5.5 and did not have the error "Error: Evaluation failed: ReferenceError: webpackJsonp is not defined".

gnadelwartz commented 4 years ago

@smashah can confirm it's working with sulla-hotfix@1.5.5 @barkerpedro thanks for pointing out

now bisect:

1.6.10: crashes on first start with different error
1.6.8: crashes on second start
1.6.5: crashes on first start
1.6.3: crashes in first start
1.6.1: display a QR code on every start ...
1.5.9: is working

1.5.9 seems to be the last version without this problem ... at least on OpenSuSE Linux

smashah commented 4 years ago

@gnadelwartz Thanks for that.

Can you:

  1. Share your create code
  2. run the latest version with autoRefresh:false:
create('session',
{
  executablePath: '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome',
  autoRefresh:false,
  headless:false
},
uaOverride
).then(client => start(client));

I'm going to fix the code to properly check for webpackjsonp for next v

smashah commented 4 years ago

@gacalixto @jigipatel @gnadelwartz @barkerpedro https://github.com/smashah/sulla/issues/75#issuecomment-580262533

gnadelwartz commented 4 years ago
sulla.create('session', {
  // For Linux:
  executablePath: '/usr/bin/chromium',
  // headless: false
}
).then(client => start(client));

I'm not using a custom UA and can't run non headless, because I'm on a headless server. Nefvertheless I don't think I'll blocked by FB, because its working flawless with 1.5.9

I'll try if autoRefresh: false change something

gnadelwartz commented 4 years ago

Tested 1.6.13:

with create as shown above I get an new error:

node dealwaecho.js
✔ Initializing whatsapp
ℹ Authenticate to continue
✔ Loading QR

(node:25048) UnhandledPromiseRejectionWarning: Error: Evaluation failed: TypeError: Cannot read property 'call' of undefined
    at t (https://web.whatsapp.com/progress.b2236901fec802a99807.js:2:412)
    at window.webpackJsonp (https://web.whatsapp.com/progress.b2236901fec802a99807.js:2:284)
    at __puppeteer_evaluation_script__:4:48
    at ExecutionContext._evaluateInternal (/home/kay/telegram/newecho/node_modules/puppeteer/lib/ExecutionContext.js:122:13)
    at process._tickCallback (internal/process/next_tick.js:68:7)
  -- ASYNC --

if I add autoRefresh: false to create I can start my script, but has to authenticate on every start:

node dealwaecho.js
✔ Initializing whatsapp
ℹ Authenticate to continue
✔ Loading QR

â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„
█ ▄▄▄▄▄ █▄▄ █▀▀███ ▄▄█ ▄ ▀█ █▀ ▄█▄█ ▄▄▄▄▄ █
█ █   █ █ ▄ ▀  ▄▀██▄█▀▀ █▀▄ ▄▀█▄ ██ █   █ █
█ █▄▄▄█ █▄▀▄ █ ▀▄▄▀▀ ▀█▀▄▄███ ▄ ▀▀█ █▄▄▄█ █
█▄▄▄▄▄▄▄█▄▀▄█▄█ ▀▄▀ █ █▄▀▄█ ▀▄▀ █ █▄▄▄▄▄▄▄█
...
██▄▄▄▄█▄▄▀ ███▄▄ ▀█ ▀ █▀███   █▄▄ ▄▄▄ ▀▀█▄█
█ ▄▄▄▄▄ ██▄   ▀ ▀█▄█▀▄▄█ ▀ ▄█▄▄▀█ █▄█ ▄█▄▀█
█ █   █ █▀██▀ ███ ▄▄▀█▄ ███▄▄ ▀▀█▄ ▄  ▄▀███
█ █▄▄▄█ █    ██▀██▄▀ ▀ ▀▀▄▄▄▀▀▄▄▀▄▀█ ▀▀█▀██
█▄▄▄▄▄▄▄█▄▄▄████▄█▄▄██▄█▄████▄▄▄▄▄▄█▄▄█▄▄██

✔ Authenticating
✔ Whatsapp is ready
30.1.2020, 16:29:40  deal processing started!
^C

node dealwaecho.js
✔ Initializing whatsapp
ℹ Authenticate to continue
✔ Loading QR

â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„
█ ▄▄▄▄▄ █▄▀▄ █▄▄█▄█▀▀▄ █▄▀█▄██▄█ ██ ▄▄▄▄▄ █
█ █   █ ██▀▀▀▀  ▄▀███▄▄▄█▀▄▄  ▀▄█▀█ █   █ █
█ █▄▄▄█ ██▄█ ▄▄▀█▄▄ ▄▀▄▀ ▀▀▀▄ ▀▀█▀█ █▄▄▄█ █
█▄▄▄▄▄▄▄█ ▀▄▀▄▀ ▀▄█ ▀ █ █ ▀▄▀▄█ █▄█▄▄▄▄▄▄▄█
...
█▄▄▄███▄█  ▀▀ █▄████▀█▀▀▀▄█ █▄▄█▀ ▄▄▄ ▄▀ ▄█
█ ▄▄▄▄▄ ████  █ ▄█  ████ ▀▄▄ ▄ ▀▀ █▄█ ▀█▄██
█ █   █ █ ▀ ▄▄ ▄▄▀█ █▄ ▀ ██▄▀▀ █▄ ▄▄▄▄██▄▄█
█ █▄▄▄█ █▀▀▀ ▄▄█ ▀▄▀ █▄▄▀ █▄ ▄▄ █▀██▄▄▄▀▄▀█
█▄▄▄▄▄▄▄█▄▄▄█████▄█████▄▄█▄█▄██▄▄▄▄▄▄▄▄████

✔ Authenticating
✔ Whatsapp is ready
30.1.2020, 16:30:22  deal processing started!
^C

node dealwaecho.js
✔ Initializing whatsapp
ℹ Authenticate to continue
✔ Loading QR

â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„
█ ▄▄▄▄▄ █▄ ▀▀▄▀███ ▄▄  ▄▀▀▀ █ ▄ ▄▄█ ▄▄▄▄▄ █
█ █   █ █ ▄▄▀▄ ▄ ▄█▄█ ▀ █▀ ▀ ██▄▀██ █   █ █
█ █▄▄▄█ █▄▀▀▀  ▀▄▄█▀ ▀██▄▄▀ ▄▄ ▄ ██ █▄▄▄█ █
█▄▄▄▄▄▄▄█▄▀ █▄█ ▀▄▀ █ █▄▀▄█▄▀ ▀ ▀▄█▄▄▄▄▄▄▄█
...
██▄▄███▄█ ██▀▄█▄▄▀█ █▀█▀██▄ ▀ ▄▄  ▄▄▄ █ █ █
█ ▄▄▄▄▄ ██▄█▄█▀ ▀ ▄██ ▄█▄▄  ▀▄▄   █▄█ ▄█▄██
█ █   █ █▀▀▄▀ ███  ▄ █▄  ▀█ ▄ ▄ ▀  ▄    ███
█ █▄▄▄█ █ ▀▀ ██▄██▄  ▀▀▄▀ ▄██▄█▀▄▀ ▄▄█ █▀██
█▄▄▄▄▄▄▄█▄█▄█▄▄█▄█▄▄█▄█▄▄▄███▄█▄▄▄▄▄▄▄█▄▄██
smashah commented 4 years ago

@gacalixto @jigipatel @gnadelwartz @barkerpedro This issue is fixed in v1.6.15

gnadelwartz commented 4 years ago

Better, but can't authenticate, hangs after rwetry QR. 1.5.9 works with the same script ... strange

 node dealwaecho.js
✔ Initializing whatsapp
Debug Info { WA_VERSION: '0.4.315',
  PAGE_UA:
   'WhatsApp/0.4.315 Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36' }
ℹ Authenticate to continue
✔ Loading QR

â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„
█ ▄▄▄▄▄ █▀ ▀▄▄██▀▀██▄██▀██ █  ▄▄▄ █ ▄▄▄▄▄ █
█ █   █ █▀ ▄▄█▀▄█▄█▄█▄ ▀▀ ▀█▀▀▀▄███ █   █ █
█ █▄▄▄█ █▀███▀▄  ▄▄ ▄ ███▀▄▄ ▄▀▀▄▄█ █▄▄▄█ █
█▄▄▄▄▄▄▄█▄▀▄▀ █▄▀ █ █ ▀▄▀ █ ▀ █▄▀ █▄▄▄▄▄▄▄█
...
█ █   █ █ ▀ ▄▄▀▀▀▀ ▀ ▀▀ ▀▄   ▀▄█▀▄▄▄▄▄ █▀██
█ █▄▄▄█ █  ▀ ▄█▄▄ █▀█▄ ▄▀ ██ ███▄▄▄█ ▄▀▄ ▄█
█▄▄▄▄▄▄▄█▄▄▄▄▄▄▄▄▄█████▄▄█▄▄█▄▄▄▄██▄▄▄█████

✔ Authenticating
✖ The session is invalid. Retrying
✔ Initializing whatsapp
Debug Info { WA_VERSION: 'I think you have been TOS_BLOCKed',
  PAGE_UA:
   'WhatsApp/0.4.315 Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36' }
Possilby TOS_BLOCKed
ℹ Authenticate to continue
✔ Loading QR
gnadelwartz commented 4 years ago

Only for the records, this is the same script with 1.5.9

node dealwaecho.js
✔ Initializing whatsapp
ℹ Authenticate to continue
✔ Loading QR
â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„
█ ▄▄▄▄▄ █▄▄ ▀ █▀█▀██▄█▀▀ ██ █▄██▄██ ▄▄▄▄▄ █
█ █   █ █  ▀█  ▄ ▄▀██ ▀▀▄▀▄ ▀ ▀▄█ █ █   █ █
█ █▄▄▄█ █▄ ▀█  ▀█▄▄▀  ▄▀█ ▀▄▄▀▄▄ ▄█ █▄▄▄█ █
█▄▄▄▄▄▄▄█▄█ █▄█ █▄▀ ▀ █ ▀▄█▄▀ ▀ █ █▄▄▄▄▄▄▄█
█▄▄▄▄█▀▄█ █ ▀█ ▄▄   ▄▀▄█▀█▄▄██▄██▀▄▀█ ▄▄█ █
...
█▄█ ▀██▄▄▀█ ▀██▀▄▄▀▄█ ▄▄▀▄██▄█▀▀▀█▄▀█▀█▀▄██
██▄▄▄▄█▄▄▀▄█▀▄█   ▄▄█▀▀█ ▄█ ▄██▄  ▄▄▄ ▄▄▀▄█
█ ▄▄▄▄▄ ███▀ █▀ █▀▄▄▀▄█▄▄█▀▄█ ▄▄▄ █▄█  █ ██
█ █   █ █▀ █  ███▀▀▀ █▄▄██  ▀▄▀█▀  ▄▄ ▄▄███
█ █▄▄▄█ █ ██ ██▄▀█▄▀▄▄ █▀ ██▀▀▄▀▄█▄▄ █▀▄▀██
█▄▄▄▄▄▄▄█▄▄▄█████▄▄▄█▄█▄█▄██▄█▄▄▄▄█▄████▄██

✔ Authenticating
✔ Whatsapp is ready
30.1.2020, 21:13:08  From: KayM (491520xxxxxx@c.us) Chat: Pfannenbot Testgruppe (4915905861477-1579xxxxxx@g.us)
30.1.2020, 21:13:08  Message:
this is my testmessage, is the BOT running?
30.1.2020, 21:13:08  Save to file: dd8c05e3-7856-4bf4-80b2-008d12c47dd3
FelipeMachado359 commented 3 years ago

How can I change the version of nulla?

my error:

Chrome not found, using chromium ✓ Checking for updates ✓ Authenticated (node:5216) UnhandledPromiseRejectionWarning: Error: Evaluation failed: ReferenceError: webpackJsonp is not defined at eval (eval at waitForPredicatePageFunction (:2:23), :5:25) at eval (eval at waitForPredicatePageFunction (:2:23), :6:23) at onRaf (puppeteer_evaluation_script:49:35) at pollRaf (puppeteer_evaluation_script:42:15) at waitForPredicatePageFunction (puppeteer_evaluation_script:7:22) at ExecutionContext._evaluateInternal (C:\Users\FelipeDev\Desktop\Code\bot\ChicoWpp\node_modules\puppeteer\lib\cjs\puppeteer\common\ExecutionContext.js:217:19) at processTicksAndRejections (internal/process/task_queues.js:97:5) at async WaitTask.rerun (C:\Users\FelipeDev\Desktop\Code\bot\ChicoWpp\node_modules\puppeteer\lib\cjs\puppeteer\common\DOMWorld.js:528:23) (Use node --trace-warnings ... to show where the warning was created) (node:5216) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) (node:5216) [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. ⠙ Injecting api...

smashah commented 3 years ago

@FelipeMachado359

the package name has changed

npm i --save @open-wa/wa-automate@latest

Please see the readme or docs.openwa.dev

FelipeMachado359 commented 3 years ago

@smashah Token not recognized :( why?

PS C:\Users\FelipeDev\Desktop\Code\bot\ChicoWpp> > npm i --save @open-wa/wa-automate@latest Token não reconhecido no texto de origem. Em linha:1 caractere:16

PS C:\Users\FelipeDev\Desktop\Code\bot\ChicoWpp>