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.1k stars 590 forks source link

Type error when/after injecting patches by wa-automate #2731

Closed gnadelwartz closed 2 years ago

gnadelwartz commented 2 years ago

Are you using the latest version of the library?

What type of session are you experiencing this issue on?

Multi-device and I have set multiDevice to true in my config OR am using the --multi-device flag

What type of host account are you experiencing this issue on?

Personal account (normal)

Mode

My own code

Current Behavior

Since today a type error happens when/after injecting patches d3aed by wa-automate

Expected Behavior

no error

Steps To Reproduce

start wa-automate in onw script :-)

create() code OR full CLI command + CONFIG

No response

DEBUG INFO

{
  "WA_VERSION": "2.2220.8",
  "WA_AUTOMATE_VERSION": "4.37.3",
  "BROWSER_VERSION": "HeadlessChrome/101.0.4951.67",
  "START_TS": 1654417090170,
  "RAM_INFO": "Total: 6.22 GB | Free: 0.68 GB",
  "PPTR_VERSION": "13.7.0",
  "LATEST_VERSION": true,
  "CLI": false
}

Environment

- OS: Linux 5.3
- Node: 16.13.2
- npm: 8.1.2

Screenshots/Logs

^[[33m┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓^[[39m
^[[33m┃^[[39m                                                                                                   ^[[33m┃^[[39m
^[[33m┃^[[39m   @open-wa/wa-automate                                                                            ^[[33m┃^[[39m
^[[33m┃^[[39m    💬 🤖 The most reliable NodeJS whatsapp library for chatbots with advanced features.           ^[[33m┃^[[39m
^[[33m┃^[[39m   Version: 4.37.3                                                                                 ^[[33m┃^[[39m
^[[33m┃^[[39m   Check out the latest changes: https://github.com/open-wa/wa-automate-nodejs#latest-changes      ^[[33m┃^[[39m
^[[33m┃^[[39m                                                                                                   ^[[33m┃^[[39m
^[[33m┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛^[[39m
- Starting
- Version: 4.37.3
- Initializing WA
- Launching Browser
- MD Enabled, turning off incognito mode.
- Data dir: ./_IGNORE_session
- Browser launched: 586ms
- Setting Up Page
- Loading session data
- Found session data file: /usr/local/telegram/dealwaecho/session.data.json
- multi-device enabled. Session data skipped...
- Existing session data injected
- Pre page launch setup complete: 18ms
- Navigating to WA
- Page loaded in 2250ms: 200
- Page loaded
- Debug info: {
  "WA_VERSION": "2.2220.8",
  "PAGE_UA": "WhatsApp/2.2147.16 Mozilla/5.0 (Macintosh; Intel Mac OS X 11_2_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36",
  "WA_AUTOMATE_VERSION": "4.37.2",
  "BROWSER_VERSION": "HeadlessChrome/101.0.4951.67",
  "OS": "Linux 5.3",
  "START_TS": 1654417090170,
  "RAM_INFO": "Total: 6.22 GB | Free: 0.68 GB",
  "PPTR_VERSION": "13.7.0"
} 
- Use this easy pre-filled link to report an issue: https://github.com/open-wa/wa-automate-nodejs/issues/new?template=bug_report.yaml&d_info=%7B%0A%20%20%22WA_VERSION%22:%20%222.2220.8%22,%0A%20%20%22WA_AUTOMATE_VERSION%22:%20%224.37.2%22,%0A%20%20%22BROWSER_VERSION%22:%20%22HeadlessChrome/101.0.4951.67%22,%0A%20%20%22START_TS%22:%201654417090170,%0A%20%20%22RAM_INFO%22:%20%22Total:%206.22%20GB%20%7C%20Free:%200.68%20GB%22,%0A%20%20%22PPTR_VERSION%22:%20%2213.7.0%22,%0A%20%20%22LATEST_VERSION%22:%20true,%0A%20%20%22CLI%22:%20false%0A%7D&enviro=-%20OS:%20Linux%205.3%0A-%20Node:%2016.13.2%0A-%20npm:%208.1.2&labels=MD
- Time to injection: 669ms
- Injecting api
- Injecting scripts                                                                                             
- Base inject: 19ms
- WAPI inject: 11ms
- Checking session integrity
- Session integrity check passed
- Launch inject: 790ms
- WAPI injected
- Authenticating
- Authenticated
- Waiting for ripe session...
- Injecting scripts
- Session ready for injection
- Reinjecting api
- Injecting scripts
- Base inject: 83ms
- Base inject: 34ms
- WAPI inject: 110ms
- Checking session integrity
- Launch inject: 503ms
- WAPI Reinjected
- Checking if session is valid
- Session integrity check passed
- Downloading patches from https://cdn.openwa.dev/patches.json
- Client is ready
- Downloaded patches in 0.155s
- Launch inject: 346ms
- Installing patches
- Patches Installed: d3aed
Error: Evaluation failed: TypeError: Cannot read properties of undefined (reading 'length')
    at Object.window.<computed>.<computed> [as launchMetrics] (__puppeteer_evaluation_script__:1:408238)
    at __puppeteer_evaluation_script__:1:23
    at ExecutionContext._evaluateInternal (/usr/local/telegram/dealwaecho/node_modules/puppeteer/src/common/ExecutionContext.ts:273:13)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at ExecutionContext.evaluate (/usr/local/telegram/dealwaecho/node_modules/puppeteer/src/common/ExecutionContext.ts:140:12)
Error while terminating browser PID. You can just ignore this, as the process has most likely been terminated successfully already: kill ESRCH
Error: Evaluation failed: TypeError: Cannot read properties of undefined (reading 'length')

Anything else?

happens with older Versions also, re-authenticating with QR code doesn't fix the problem (as it was the case with others in md mode)

smashah commented 2 years ago

I can't reproduce this error with the given context.

I'm on wa_web version 2.2218.8

Seems as though they pushed an update in the weekend

smashah commented 2 years ago

Basically your chat, msg or contacts store is undefined for some reason. Is this host account completely fresh?

smashah commented 2 years ago

@gnadelwartz pushed new patches. should prevent the error but i dont think it will fix the underlying issue. Will leave this open till I can test it out with that wa web version

gnadelwartz commented 2 years ago

can confirm error is gone, but not sending messages

account is not new, wa-automate say's "0 contacts, 0 chats & 0 messages" but account has 142 contacts and 15 chats

- Patches Installed: 63e3f
- Client loaded for normal account [MD] with 0 contacts, 0 chats & 0 messages in 40.814s
- Finalizing web session...
- Finalizing client...
┌───────────────────────────────────────────────────────┐
│                                                       │
│   Use the link below to easily report issues:👇👇👇   │
│                                                       │
└───────────────────────────────────────────────────────┘
- https://github.com/open-wa/wa-automate-nodejs/issues/new?template=bug_report.yaml&d_info=%7B%0A%20%20%22WA_VERSION%22:%20%222.2220.8%22,%0A%20%20%22WA_AUTOMATE_VERSION%22:%20%224.37.4%22,%0A%20%20%22BROWSER_VERSION%22:%20%22HeadlessChrome/101.0.4951.67%22,%0A%20%20%22START_TS%22:%201654443818989,%0A%20%20%22RAM_INFO%22:%20%22Total:%206.22%20GB%20%7C%20Free:%201.84%20GB%22,%0A%20%20%22PPTR_VERSION%22:%20%2213.7.0%22,%0A%20%20%22LATEST_VERSION%22:%20true,%0A%20%20%22CLI%22:%20false,%0A%20%20%22PATCH_HASH%22:%20%2263e3f%22,%0A%20%20%22LAUNCH_TIME_MS%22:%2040814,%0A%20%20%22ACC_TYPE%22:%20%22PERSONAL%22,%0A%20%20%22chats%22:%200,%0A%20%20%22messages%22:%200,%0A%20%20%22contacts%22:%200,%0A%20%20%22isMd%22:%20true,%0A%20%20%22INSTANCE_ID%22:%20%228f27e35f-843f-4b06-8b8e-9d0609f297ad%22%0A%7D&enviro=-%20OS:%20Linux%205.3%0A-%20Node:%2016.13.2%0A-%20npm:%208.1.2&labels=MD,PHA
- 🚀 @OPEN-WA ready for account: 1477

sending message silently fail, when sending a picture type error occurs, I'll try if re auth with QR code fix this:

5.6.2022, 17:48:59 picture: https://static.mydealz.de/threads/raw/lhalj/1997686_1
Error: Evaluation failed: TypeError: Cannot read properties of undefined (reading 'length')
    at Object.window.<computed>.<computed> [as sendImage] (__puppeteer_evaluation_script__:1:102947)
    at ExecutionContext._evaluateInternal (/usr/local/telegram/dealwaecho/node_modules/puppeteer/src/common/ExecutionContext.ts:273:13)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at ExecutionContext.evaluate (/usr/local/telegram/dealwaecho/node_modules/puppeteer/src/common/ExecutionContext.ts:140:12)
gnadelwartz commented 2 years ago

same problem after re authentication :-/

^[[33m┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓^[[39m^[[33m┃^[[39m                                                                           ^[[33m┃^[[39m^[[33m┃^[[39m   @open-wa/wa-automate                                                    ^[[33m┃^[[39m^[[33m┃^[[39m   💬 🤖 The most reliable NodeJS whatsapp library for chatbots with       ^[[33m┃^[[39m^[[33m┃^[[39m   advanced features.                                                      ^[[33m┃^[[39m^[[33m┃^[[39m   Version: 4.37.4                                                         ^[[33m┃^[[39m^[[33m┃^[[39m   Check out the latest changes:                                           ^[[33m┃^[[39m^[[33m┃^[[39m   https://github.com/open-wa/wa-automate-nodejs#latest-changes            ^[[33m┃^[[39m^[[33m┃^[[39m                                                                           ^[[33m┃^[[39m^[[33m┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛^[[39m
- Starting
- Version: 4.37.4
- Initializing WA
- Launching Browser
- MD Enabled, turning off incognito mode.
- Data dir: ./_IGNORE_session
- Browser launched: 406ms
- Setting Up Page
- Loading session data
- No session data file found for session : session
- No session data detected. Opting in for MD.
- Make sure to keep the session alive for at least 5 minutes after scanning the QR code before trying to restart a session!!
- Pre page launch setup complete: 12ms
- Navigating to WA
- Page loaded in 1347ms: 200
- Page loaded
- Debug info: { 
  "WA_VERSION": "2.2220.8",
  "PAGE_UA": "WhatsApp/2.2147.16 Mozilla/5.0 (Macintosh; Intel Mac OS X 11_2_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36",
  "WA_AUTOMATE_VERSION": "4.37.4",
  "BROWSER_VERSION": "HeadlessChrome/101.0.4951.67",
  "OS": "Linux 5.3",
  "START_TS": 1654444641866,
  "RAM_INFO": "Total: 6.22 GB | Free: 1.38 GB",
  "PPTR_VERSION": "13.7.0"
}
- Use this easy pre-filled link to report an issue: https://github.com/open-wa/wa-automate-nodejs/issues/new?template=bug_report.yaml&d_info=%7B%0A%20%20%22WA_VERSION%22:%20%222.2220.8%22,%0A%20%20%22WA_AUTOMATE_VERSION%22:%20%224.37.4%22,%0A%20%20%22BROWSER_VERSION%22:%20%22HeadlessChrome/101.0.4951.67%22,%0A%20%20%22START_TS%22:%201654444641866,%0A%20%20%22RAM_INFO%22:%20%22Total:%206.22%20GB%20%7C%20Free:%201.38%20GB%22,%0A%20%20%22PPTR_VERSION%22:%20%2213.7.0%22,%0A%20%20%22LATEST_VERSION%22:%20true,%0A%20%20%22CLI%22:%20false%0A%7D&enviro=-%20OS:%20Linux%205.3%0A-%20Node:%2016.13.2%0A-%20npm:%208.1.2&labels=MD
- Time to injection: 2144ms
- Injecting api
- Injecting scripts
- Base inject: 52ms
- WAPI inject: 318ms
- Checking session integrity
- Session integrity check passed
- Launch inject: 660ms
- WAPI injected
- Authenticating
- Authenticate to continue
- First QR: 7438 ms
┌─────────────────────────────────────────────────────────────┐
│                                                             │
│   ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄   │
│   █ ▄▄▄▄▄ █▄▀█▀█▄▀ █▀█▄█▀▄▀▄█▄▀█ ▄   ▀▀▄▀█ ██ ▀██ ▄▄▄▄▄ █   │
│   █ █   █ █    ▄ ▄█ ▀ █▄█████▀█▄▀▀ ▄█▄   █▄▄▀▀▄▀█ █   █ █   │
│   █ █▄▄▄█ █▄   ▀▄▀▀█▄█▄  ▀█ ▄▄▄ ██▄█ ▀▄▀▄▄██  ███ █▄▄▄█ █   │
│   █▄▄▄▄▄▄▄█▄█ █ █▄█▄█▄█ █▄▀ █▄█ █ █ █▄█▄█▄▀ ▀▄█▄█▄▄▄▄▄▄▄█   │
│   █▄▄▄▄█▀▄▀ ▄ █▄█▄█ ▄█ ▄ ▄▀▄ ▄  ▄▀████ ▀▄█▀▄▀ ▀█▄█▀ ▄ ▀ █   │
│   █▀▄▀▀  ▄ █▀▄▄█▀▄▀▄█▄▀▄ █▀█▄█▄▀█▄▄ ▄█▀█ █ █▄▄██▀▄███▄▄██   │
│   █▄▄▄█▀▄▄  ▄█▀▄ ▀▀▄▄▄ ▀█▀ ▀▄▄▄▄██▀█▄█  █▀████▀ ▄▄ ▄▄▄▀██   │
│   █  ▀▀██▄▀███▄▄ ████ █▀▀██  ▄▄   ▀▀▄██ █▄ ▄▀ █  ▀▀▄ ▄▄ █   │
│   █▄▀▀█ ▄▄▀▄███ █▄▄▀▀▀▄▄▄█▀▀▄▄ █▀█    ▀██▄ █▀█▄█  ▄▀    █   │
│   █ ▀  ██▄▀█▀█▄ ▀▀███▄█  ▄██▀▀▀▀██▀▄ █▄▄▄█▄▄█▄▀▀ ██▀▀▀▀▀█   │
│   █ ▄█▄█ ▄▀▀ ▄████▄▄▀██▄  █▄ ▄██ ▀▀█▄█ ▀ █ ▄█  ▄▄██▀██▀ █   │
│   █▄ ▄ █▀▄▀  ▀▀▄ ▀▄██▀▀▀▀▄█▄▄█ ▀  ▀▄▀▄▀▄ ██▄▀ ▀██▄█ ▀▄▀▀█   │
│   █ █ █ ▄▄▄ █▀ ▀▄  ▀█ ▀▀██  ▄▄▄ ▄▄ █ █▄ █ ▄▀██▄ ▄▄▄ ▄  ▀█   │
│   ██  ▀ █▄█ ▄▄▄ ▀██▀█ █  █  █▄█  ▀▄█▀▀█▀█▄ ▄█ █ █▄█ ▀▄ ▄█   │
│   █▄▄██  ▄ ▄▄▀▄ █    ▀▄▄ █▄   ▄ ▀█ ▄▄▀▀▀▀▄ ▀▀▄▄▄   ▄▀ ▀▀█   │
│   █ ▄▀█ ▄▄  ▀▀  ▀▀ █▀▄  ▄ ▀▀   █ █▄▀ ▄ ▀▄▄  █ █▄▀▀█▄▀▀█▀█   │
│   █▄ █▄█▀▄▀▀ ▀   █ ▄▀█ ██ ▀ ▄▀ █▀▀█▀ █ ▀▀█ ▄▀ ▄ ▄ █  ▀▀▄█   │
│   █▄ ▄ ▄▀▄██▀▄▀▄▀ ▄▀▄▀ █ ▀  ▄█  ▄ ▀▀▄▄▄▀█▄▄▀▄  ▀ ▀▀▀▄▄▄██   │
│   █▀▄ ▄ ▄▄█▄ █ ▄▄██▄ ▄▀▀███  ▀▄▄▀█▄▀▀▄▄ ▄ ██ ▄█▄▄  ██  ██   │
│   █▄▄▄▄▄█▄██  █ █ ▀   ▀█ ▄▀▄▀ ▄▄▄ ▀ █▄▀▀█  ▄ ▄█▀█ █▄█▄ ▄█   │
│   █ ▄█▀█▀▄▀ ▄█   █▀█▄█▄█ █ ▀▄▄ ▀▀▄▄▄ ▀▀▀▄█ ▀▀▄█▀▀▀█▄ ▀ ██   │
│   █▄ ▀▄▄▄▄▄█  ▄███    ▄▄ ███▀▀▀▄▀██▄▄▄ ██ ▀▀ █ █▀▀█▄▀  ██   │
│   ████▄██▄█▀▄▀▀▀▀▄▄█▄█ ▄  ▀ ▄▄▄ ▀▀ █ ▄ █ ▄▄     ▄▄▄ ▄█▀▀█   │
│   █ ▄▄▄▄▄ ████▄▄▀▄▄▀█  █▄▀  █▄█ ▄█▄▀ ▄█▄   ▄▄█▀ █▄█ ▄█ ▀█   │
│   █ █   █ █▀ ▀ ▀█▀██ █▀  ▀█▄  ▄ ████▀▄ ▄▀ ▀▀█▄█▄▄▄▄ ▀▀▀▄█   │
│   █ █▄▄▄█ █  ▄▄▀█  ▄▄▀▀█ ▀█▀██▀▄   ▀▀▄█▄█▄▀█▀█▄▀▀█▄▀▄█ ██   │
│   █▄▄▄▄▄▄▄█▄█▄▄▄█▄█▄██▄▄▄█████▄██▄█▄████▄▄▄██▄█▄▄▄█▄▄█▄██   │
│                                                             │
│                                                             │
└─────────────────────────────────────────────────────────────┘
- Multi device support for this project is EXPERIMENTAL. Some things may not work....
- Injecting scripts
- Injecting scripts
- Reinjecting api
- Injecting scripts
- Base inject: 84ms
- Base inject: 18ms
- Launch inject: 442ms
- Launch inject: 753ms
- WAPI Reinjected
- Checking if session is valid
- Downloading patches from https://cdn.openwa.dev/patches.json
- Client is ready
- Downloaded patches in 0.2s
- Installing patches
- Patches Installed: 63e3f
- Client loaded for normal account [MD] with 0 contacts, 0 chats & 0 messages in 24.286s
- Finalizing web session...
- Finalizing client...
^[[31m┌───────────────────────────────────────────────────────┐^[[39m
^[[31m│^[[39m                                                       ^[[31m│^[[39m
^[[31m│^[[39m   Use the link below to easily report issues:👇👇👇   ^[[31m│^[[39m
^[[31m│^[[39m                                                       ^[[31m│^[[39m
^[[31m└───────────────────────────────────────────────────────┘^[[39m
- https://github.com/open-wa/wa-automate-nodejs/issues/new?template=bug_report.yaml&d_info=%7B%0A%20%20%22WA_VERSION%22:%20%222.2220.8%22,%0A%20%20%22WA_AUTOMATE_VERSION%22:%20%224.37.4%22,%0A%20%20%22BROWSER_VERSION%22:%20%22HeadlessChrome/101.0.4951.67%22,%0A%20%20%22START_TS%22:%201654444641866,%0A%20%20%22RAM_INFO%22:%20%22Total:%206.22%20GB%20%7C%20Free:%201.38%20GB%22,%0A%20%20%22PPTR_VERSION%22:%20%2213.7.0%22,%0A%20%20%22LATEST_VERSION%22:%20true,%0A%20%20%22CLI%22:%20false,%0A%20%20%22PATCH_HASH%22:%20%2263e3f%22,%0A%20%20%22LAUNCH_TIME_MS%22:%2024286,%0A%20%20%22ACC_TYPE%22:%20%22PERSONAL%22,%0A%20%20%22chats%22:%200,%0A%20%20%22messages%22:%200,%0A%20%20%22contacts%22:%200,%0A%20%20%22isMd%22:%20true,%0A%20%20%22INSTANCE_ID%22:%20%228117ce85-6a42-40e0-b0e8-fa73258766da%22%0A%7D&enviro=-%20OS:%20Linux%205.3%0A-%20Node:%2016.13.2%0A-%20npm:%208.1.2&labels=MD,PHA
- 🚀 @OPEN-WA ready for account: 1477
5.6.2022, 17:57:47 =========== deal processing started ============
^[[?25l⸨^[[100;90m⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂^[[0m⸩ ⠇ reify: ^[[32;40mtiming^[[0m ^[[35marborist:ctor^[[0m Completed in 1ms^[[0m^[[K^M⸨^[[100;90m⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂^[[0m⸩ ⠹ idealTree:dealwaecho: ^[[32;40mtiming^[[0m ^[[35midealTree:init^[[0m Completed^[[0m^[[K^M⸨^[[100;90m⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂^[[0m⸩ ⠹ idealTree:dealwaecho: ^[[32;40mtiming^[[0m ^[[35midealTree:init^[[0m Completed^[[0m^[[K^M⸨^[[100;90m⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂^[[0m⸩ ⠸ idealTree:dealwaecho: ^[[32;40mtiming^[[0m ^[[35midealTree:init^[[0m Completed^[[0m^[[K^M⸨^[[100;90m⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂^[[0m⸩ ⠸ idealTree:dealwaecho: ^[[32;40mtiming^- Injecting scripts
- Injecting scripts
- Reinjecting api
- Injecting scripts
- Base inject: 84ms
- Base inject: 18ms
- Launch inject: 442ms
- Launch inject: 753ms
- WAPI Reinjected
- Checking if session is valid
- Downloading patches from https://cdn.openwa.dev/patches.json
- Client is ready
- Downloaded patches in 0.2s
- Installing patches
- Patches Installed: 63e3f
- Client loaded for normal account [MD] with 0 contacts, 0 chats & 0 messages in 24.286s
- Finalizing web session...
- Finalizing client...
^[[31m┌───────────────────────────────────────────────────────┐^[[39m
^[[31m│^[[39m                                                       ^[[31m│^[[39m
^[[31m│^[[39m   Use the link below to easily report issues:👇👇👇   ^[[31m│^[[39m
^[[31m│^[[39m                                                       ^[[31m│^[[39m
^[[31m└───────────────────────────────────────────────────────┘^[[39m
- https://github.com/open-wa/wa-automate-nodejs/issues/new?template=bug_report.yaml&d_info=%7B%0A%20%20%22WA_VERSION%22:%20%222.2220.8%22,%0A%20%20%22WA_AUTOMATE_VERSION%22:%20%224.37.4%22,%0A%20%20%22BROWSER_VERSION%22:%20%22HeadlessChrome/101.0.4951.67%22,%0A%20%20%22START_TS%22:%201654444641866,%0A%20%20%22RAM_INFO%22:%20%22Total:%206.22%20GB%20%7C%20Free:%201.38%20GB%22,%0A%20%20%2
2PPTR_VERSION%22:%20%2213.7.0%22,%0A%20%20%22LATEST_VERSION%22:%20true,%0A%20%20%22CLI%22:%20false,%0A%20%20%22PATCH_HASH%22:%20%2263e3f%22,%0A%20%20%22LAUNCH_TIME_MS%22:%2024286,%0A%20%20%22ACC_TYPE%22:%20%22PERSONAL%22,%0A%20%20%22chats%22:%200,%0A%20%20%22messages%22:%200,%0A%20%20%22contacts%22:%200,%0A%20%20%22isMd%22:%20true,%0A%20%20%22INSTANCE_ID%22:%20%228117ce85-6a42-40e0-b0e8-fa73258766da%22%0A%7D&enviro=-%20OS:%20Linux%205.3%0A-%20Node:%2016.13.2%0A-%20npm:%208.1.2&labels=MD,PHA
- 🚀 @OPEN-WA ready for account: 1477
5.6.2022, 17:57:47 =========== deal processing started ============
- session_STARTUP
- Injecting scripts
- Base inject: 7ms
- Launch inject: 166ms
5.6.2022, 18:01:02 ******** Forward detected: 4106911b74a81d8f307a2215d9376a15cf330c8d.lnk:report_haushalt.sh:4915905861477-1626848692@g.us
5.6.2022, 18:01:02 send text:  🛒 ASTRO A40 TR Gaming-Headset Mod-Kit, 3. Generation, Stimmisolierendes Mikrofon,Ohrpolster mit Geräuschunterdrückung, Gepolsterter Kopfbügel, Lautsprecher-Tags mit Geräuschisolierung - Grün | 50,99 € 💶 | 4.6 *
5.6.2022, 18:01:02 picture: https://m.media-amazon.com/images/I/41hI6Q2l-aL._SL500_.jpg
Error: Evaluation failed: TypeError: Cannot read properties of undefined (reading 'length')
    at Object.window.<computed>.<computed> [as sendImage] (__puppeteer_evaluation_script__:1:102947)
    at ExecutionContext._evaluateInternal (/usr/local/telegram/dealwaecho/node_modules/puppeteer/src/common/ExecutionContext.ts:273:13)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at ExecutionContext.evaluate (/usr/local/telegram/dealwaecho/node_modules/puppeteer/src/common/ExecutionContext.ts:140:12)
smashah commented 2 years ago

As expected.

I need to wait for 2.2220.8 here. Unless you can let me remote into your headful session - if yes DM me on discord as I only have like 20 mins to debug and fix this before I have to go.

smashah commented 2 years ago

@gnadelwartz I got 2220.8,

annoying small change resulting in a lot of work.

Pushed a patch. please restart and try again.

shifoc commented 2 years ago

I am getting this error and the bot is not reading/replying to messages

Error Evaluation failed: ReferenceError: unread is not defined
0|index  |     at __puppeteer_evaluation_script__:1:269623
0|index  |     at Array.map (<anonymous>)
0|index  |     at Object.window.<computed>.<computed> [as getAllUnreadMessages] (__puppeteer_evaluation_script__:1:269455)
0|index  |     at __puppeteer_evaluation_script__:1:13
smashah commented 2 years ago

@shifoc patched

gnadelwartz commented 2 years ago

I can't send messages and it continues crashing on sending picrues with (different) Type error.

^[[33m┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓^[[39m
^[[33m┃^[[39m                                                                                                   ^[[33m┃^[[39m
^[[33m┃^[[39m   @open-wa/wa-automate                                                                            ^[[33m┃^[[39m
^[[33m┃^[[39m    💬 🤖 The most reliable NodeJS whatsapp library for chatbots with advanced features.           ^[[33m┃^[[39m
^[[33m┃^[[39m   Version: 4.37.5                                                                                 ^[[33m┃^[[39m
^[[33m┃^[[39m   Check out the latest changes: https://github.com/open-wa/wa-automate-nodejs#latest-changes      ^[[33m┃^[[39m
^[[33m┃^[[39m                                                                                                   ^[[33m┃^[[39m
^[[33m┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛^[[39m
- Starting
- Version: 4.37.5
- Initializing WA
- Launching Browser
- MD Enabled, turning off incognito mode.
- Data dir: ./_IGNORE_session
- Browser launched: 432ms
- Setting Up Page
- Loading session data
- Found session data file: /usr/local/telegram/dealwaecho/session.data.json
- multi-device enabled. Session data skipped...
- Existing session data injected
- Pre page launch setup complete: 13ms
- Navigating to WA
- Page loaded in 2008ms: 200
- Page loaded
- Debug info: {
  "WA_VERSION": "2.2220.8",
  "PAGE_UA": "WhatsApp/2.2147.16 Mozilla/5.0 (Macintosh; Intel Mac OS X 11_2_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36",
  "WA_AUTOMATE_VERSION": "4.37.5",
  "BROWSER_VERSION": "HeadlessChrome/101.0.4951.67",
  "OS": "Linux 5.3",
  "START_TS": 1654494687772,
  "RAM_INFO": "Total: 6.22 GB | Free: 0.84 GB",
  "PPTR_VERSION": "13.7.0"
} 
- Use this easy pre-filled link to report an issue: https://github.com/open-wa/wa-automate-nodejs/issues/new?template=bug_report.yaml&d_info=%7B%0A%20%20%22WA_VERSION%22:%20%222.2220.8%22,%0A%20%20%22WA_AUTOMATE_VERSION%22:%20%224.37.5%22,%0A%20%20%22BROWSER_VERSION%22:%20%22HeadlessChrome/101.0.4951.67%22,%0A%20%20%22START_TS%22:%201654494687772,%0A%20%20%22RAM_INFO%22:%20%22Total:%206.22%20GB%20%7C%20Free:%200.84%20GB%22,%0A%20%20%22PPTR_VERSION%22:%20%2213.7.0%22,%0A%20%20%22LATEST_VERSION%22:%20true,%0A%20%20%22CLI%22:%20false%0A%7D&enviro=-%20OS:%20Linux%205.3%0A-%20Node:%2016.13.2%0A-%20npm:%208.1.2&labels=MD
- Time to injection: 741ms
- Use this easy pre-filled link to report an issue: https://github.com/open-wa/wa-automate-nodejs/issues/new?template=bug_report.yaml&d_info=%7B%0A%20%20%22WA_VERSION%22:%20%222.2220.8%22,%0A%20%20%22WA_AUTOMATE_VERSION%22:%20%224.37.5%22,%0A%20%20%22BROWSER_VERSION%22:%20%22HeadlessChrome/101.0.4951.67%22,%0A%20%20%22START_TS%22:%201654494687772,%0A%20%20%22RAM_INFO%22:%20%22Total:%206.22%20GB%20%7C%20Free:%200.84%20GB%22,%0A%20%20%22PPTR_VERSION%22:%20%2213.7.0%22,%0A%20%20%22LATEST_VERSION%22:%20true,%0A%20%20%22CLI%22:%20false%0A%7D&enviro=-%20OS:%20Linux%205.3%0A-%20Node:%2016.13.2%0A-%20npm:%208.1.2&labels=MD
- Time to injection: 741ms
- Injecting scripts
- Base inject: 18ms
- WAPI inject: 11ms
- Checking session integrity
- Session integrity check passed
- Launch inject: 955ms
- WAPI injected
- Authenticating
- Authenticated
- Waiting for ripe session...
- Injecting scripts
- Session ready for injection
- Reinjecting api
- Injecting scripts
- Base inject: 46ms
- Base inject: 52ms
- WAPI inject: 100ms
- Checking session integrity
- WAPI inject: 103ms
- Checking session integrity
- Session integrity check passed
- Session integrity check passed
- Launch inject: 372ms
- Launch inject: 828ms
- WAPI Reinjected
- Checking if session is valid
- Downloading patches from https://cdn.openwa.dev/patches.json
- Client is ready
- Downloaded patches in 0.28s
- Installing patches
- Patches Installed: edc95
- Client loaded for normal account [MD] with 586 contacts, 14 chats & 14 messages in 19.545s
- Finalizing web session...
- Finalizing client...
^[[31m┌───────────────────────────────────────────────────────┐^[[39m
^[[31m│^[[39m                                                       ^[[31m│^[[39m
^[[31m│^[[39m   Use the link below to easily report issues:👇👇👇   ^[[31m│^[[39m
^[[31m│^[[39m                                                       ^[[31m│^[[39m
^[[31m└───────────────────────────────────────────────────────┘^[[39m
- https://github.com/open-wa/wa-automate-nodejs/issues/new?template=bug_report.yaml&d_info=%7B%0A%20%20%22WA_VERSION%22:%20%222.2220.8%22,%0A%20%20%22WA_AUTOMATE_VERSION%22:%20%224.37.5%22,%0A%20%20%22BROWSER_VERSION%22:%20%22HeadlessChrome/101.0.4951.67%22,%0A%20%20%22START_TS%22:%201654494687772,%0A%20%20%22RAM_INFO%22:%20%22Total:%206.22%20GB%20%7C%20Free:%200.84%20GB%22,%0A%20%20%22PPTR_VERSION%22:%20%2213.7.0%22,%0A%20%20%22LATEST_VERSION%22:%20true,%0A%20%20%22CLI%22:%20false,%0A%20%20%22PATCH_HASH%22:%20%22edc95%22,%0A%20%20%22LAUNCH_TIME_MS%22:%2019545,%0A%20%20%22ACC_TYPE%22:%20%22PERSONAL%22,%0A%20%20%22chats%22:%2014,%0A%20%20%22messages%22:%2014,%0A%20%20%22contacts%22:%20586,%0A%20%20%22isMd%22:%20true,%0A%20%20%22INSTANCE_ID%22:%20%220d573953-8a07-461c-9442-af221c5be95e%22%0A%7D&enviro=-%20OS:%20Linux%205.3%0A-%20Node:%2016.13.2%0A-%20npm:%208.1.2&labels=MD,PHA
- 🚀 @OPEN-WA ready for account: 1477
6.6.2022, 07:51:48 =========== deal processing started ============
### startup message not sent
6.6.2022, 07:54:25 ******** Forward detected: 1e0197c03a285cb52b9d2cdaa23962ca83225d40.lnk:report_haushalt.sh:4915905861477-1626848692@g.us
6.6.2022, 07:54:25 send text:  🛒 McVitie's Digestive 1 x 250 g — knusprige Kekse aus Großbritannien —unvergleichlich leckere Bisquits nach traditioneller Rezeptur — Original |1,43 € 💶 (10% SparAbo) | 4.4 *
6.6.2022, 07:54:25 picture: https://m.media-amazon.com/images/I/51apUdPWRwL._SL500_.jpg
Error: Evaluation failed: TypeError: Cannot read properties of undefined (reading '0')
    at __puppeteer_evaluation_script__:1:119809
    at async Object.window.<computed>.<computed> [as sendImage] (__puppeteer_evaluation_script__:1:119294)
    at ExecutionContext._evaluateInternal (/usr/local/telegram/dealwaecho/node_modules/puppeteer/src/common/ExecutionContext.ts:273:13)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at ExecutionContext.evaluate (/usr/local/telegram/dealwaecho/node_modules/puppeteer/src/common/ExecutionContext.ts:140:12)
gnadelwartz commented 2 years ago

I created a minimal script to reproduce my problems and did some tests:

here is my test script: min-test.ts.zip

smashah commented 2 years ago

@gnadelwartz images patched

smashah commented 2 years ago

@gnadelwartz I'm testing using the EASY API. I can send messages just fine. Any other context?

gnadelwartz commented 2 years ago

@smashah testscript was running without errors but no messages recieved on phone. after re authenticating everything works again.

thanks!

gnadelwartz commented 2 years ago

I did a replay of 24h's missed content (~700 Pictures/messages) without problem :-)

gnadelwartz commented 2 years ago

@smashah just for reference: problem is back, since today.

sending messages and picture does succeed (no error, no blocking), but no message/picture is sent (event onAnyMessage not triggerd also).

re auth doesn't help, older version 4.37.5 has same problem, wa version seems not changed

############ WhatsApp BOT started #############################
^[[33m┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓^[[39m^[[33m┃^[[39m                                                                              ^[[33m┃^[[39m^[[33m┃^[[39m   @open-wa/wa-automate                                                       ^[[33m┃^[[39m^[[33m┃^[[39m   💬 🤖 The most reliable NodeJS whatsapp library for chatbots with          ^[[33m┃^[[39m^[[33m┃^[[39m   advanced features.                                                         ^[[33m┃^[[39m^[[33m┃^[[39m   Version: 4.38.1                                                            ^[[33m┃^[[39m^[[33m┃^[[39m   Check out the latest changes:                                              ^[[33m┃^[[39m^[[33m┃^[[39m   https://github.com/open-wa/wa-automate-nodejs#latest-changes               ^[[33m┃^[[39m^[[33m┃^[[39m                                                                              ^[[33m┃^[[39m^[[33m┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛^[[39m
- Starting
- Version: 4.38.1
- Initializing WA
- Launching Browser
- MD Enabled, turning off incognito mode.
- Data dir: ./_IGNORE_session
- Browser launched: 9601ms
- Setting Up Page
- Loading session data
- Found session data file: /usr/local/telegram/dealwaecho/session.data.json
- multi-device enabled. Session data skipped...
- Existing session data injected
- Pre page launch setup complete: 43ms
- Navigating to WA
- Page loaded in 4130ms: 200
- Page loaded
- Debug info: {
  "WA_VERSION": "2.2220.8",
  "PAGE_UA": "WhatsApp/2.2147.16 Mozilla/5.0 (Macintosh; Intel Mac OS X 11_2_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36",
  "WA_AUTOMATE_VERSION": "4.38.1",
  "BROWSER_VERSION": "HeadlessChrome/101.0.4951.67",
  "OS": "Linux 5.3",
  "START_TS": 1654669158926,
  "RAM_INFO": "Total: 6.22 GB | Free: 0.12 GB",
  "PPTR_VERSION": "13.7.0"
}
- Use this easy pre-filled link to report an issue: https://github.com/open-wa/wa-automate-nodejs/issues/new?template=bug_report.yaml&d_info=%7B%0A%20%20%22WA_VERSION%22:%20%222.2220.8%22,%0A%20%20%22WA_AUTOMATE_VERSION%22:%20%224.38.0%22,%0A%20%20%22BROWSER_VERSION%22:%20%22HeadlessChrome/101.0.4951.67%22,%0A%20%20%22START_TS%22:%201654669158926,%0A%20%20%22RAM_INFO%22:%20%22Total:%206.22%20GB%20%7C%20Free:%200.12%20GB%22,%0A%20%20%22PPTR_VERSION%22:%20%2213.7.0%22,%0A%20%20%22LATEST_VERSION%22:%20true,%0A%20%20%22CLI%22:%20false%0A%7D&enviro=-%20OS:%20Linux%205.3%0A-%20Node:%2016.13.2%0A-%20npm:%208.1.2&labels=MD
- Time to injection: 7180ms
- Injecting api
- Injecting scripts
- Base inject: 28ms
- WAPI inject: 22ms
- Checking session integrity
- Session integrity check passed
- Launch inject: 1976ms
- WAPI injected
- Authenticating
- Authenticated
- Waiting for ripe session...
- Injecting scripts
- Session ready for injection
- Reinjecting api
- Injecting scripts
- Base inject: 263ms
- Base inject: 182ms
- WAPI inject: 132ms
- Checking session integrity
- WAPI inject: 145ms
- Checking session integrity
- Session integrity check passed
- Session integrity check passed
- Launch inject: 964ms
- Launch inject: 1305ms
- WAPI Reinjected
- Checking if session is valid
- Downloading patches from https://cdn.openwa.dev/patches.json
- Client is ready
- Downloaded patches in 0.383s
- Installing patches
- Patches Installed: ffb3b
- Client loaded for normal account [MD] with 587 contacts, 14 chats & 29 messages in 35.369s
- Finalizing web session...
- Finalizing client...
^[[31m┌───────────────────────────────────────────────────────┐^[[39m
^[[31m│^[[39m                                                       ^[[31m│^[[39m
^[[31m│^[[39m   Use the link below to easily report issues:👇👇👇   ^[[31m│^[[39m
^[[31m│^[[39m                                                       ^[[31m│^[[39m
^[[31m└───────────────────────────────────────────────────────┘^[[39m
- https://github.com/open-wa/wa-automate-nodejs/issues/new?template=bug_report.yaml&d_info=%7B%0A%20%20%22WA_VERSION%22:%20%222.2220.8%22,%0A%20%20%22WA_AUTOMATE_VERSION%22:%20%224.38.0%22,%0A%2
0%20%22BROWSER_VERSION%22:%20%22HeadlessChrome/101.0.4951.67%22,%0A%20%20%22START_TS%22:%201654669158926,%0A%20%20%22RAM_INFO%22:%20%22Total:%206.22%20GB%20%7C%20Free:%200.12%20GB%22,%0A%20%20%22PPTR_VERSION%22:%20%2213.7.0%22,%0A%20%20%22LATEST_VERSION%22:%20true,%0A%20%20%22CLI%22:%20false,%0A%20%20%22PATCH_HASH%22:%20%22ffb3b%22,%0A%20%20%22LAUNCH_TIME_MS%22:%2035369,%0A%20%20%22ACC_TYPE%22:%20%22PERSONAL%22,%0A%20%20%22chats%22:%2014,%0A%20%20%22messages%22:%2029,%0A%20%20%22contacts%22:%20587,%0A%20%20%22isMd%22:%20true,%0A%20%20%22INSTANCE_ID%22:%20%22d69dd380-54df-4482-a6b5-874458883d41%22%0A%7D&enviro=-%20OS:%20Linux%205.3%0A-%20Node:%2016.13.2%0A-%20npm:%208.1.2&labels=MD,PHA
- 🚀 @OPEN-WA ready for account: 1477
8.6.2022, 08:19:42 =========== deal processing started ============
gnadelwartz commented 2 years ago

@smashah as far I can see you did not change anything (patches/version). but after deleted WA App from phone and setup again problem is gone. looks like MD is a strange beast.

hope you are not bothered by my reporting of strange problems ;-)

smashah commented 2 years ago

It's ok. Keep this info coming