D3vl0per / Twitch-watcher

Automatic watching the twitch to get Valorant drop
MIT License
226 stars 65 forks source link

UnhandledPromiseRejectionWarning: Error: Evaluation failed: TypeError: Cannot read property 'scrollIntoView' of undefined #77

Closed vinhtq115 closed 3 years ago

vinhtq115 commented 4 years ago

I'm trying to run this on my Raspberry Pi 4B and it always throws this error:

========================= 🔎 Checking config file... ❌ No config file found! ? Enter your auth-token from twitch.tv 🔑: [hidden] ? Enter the chromium executable path (usually /usr/bin/chromium-browser or /usr/bin/chromium or C:\P rogram Files (x86)\Google\Chrome\Application\chrome.exe): /usr/bin/chromium

📱 Launching browser... 🔧 Setting User-Agent... 🔧 Setting auth token... ⏰ Setting timeouts...

🔐 Checking login... ✅ Login successful! 📡 Checking active streamers... 🔨 Emulating scrolling... (node:2982) UnhandledPromiseRejectionWarning: Error: Evaluation failed: TypeError: Cannot read property 'scrollIntoView' of undefined at puppeteer_evaluation_script:3:12 at ExecutionContext._evaluateInternal (/home/dietpi/Twitch-watcher/node_modules/puppeteer-core/lib/ExecutionContext.js:122:13) at processTicksAndRejections (internal/process/task_queues.js:93:5) at async ExecutionContext.evaluate (/home/dietpi/Twitch-watcher/node_modules/puppeteer-core/lib/ExecutionContext.js:48:12) at async scroll (/home/dietpi/Twitch-watcher/app.js:283:5) at async getAllStreamer (/home/dietpi/Twitch-watcher/app.js:246:3) at async main (/home/dietpi/Twitch-watcher/app.js:360:3) -- ASYNC -- at ExecutionContext. (/home/dietpi/Twitch-watcher/node_modules/puppeteer-core/lib/helper.js:111:15) at DOMWorld.evaluate (/home/dietpi/Twitch-watcher/node_modules/puppeteer-core/lib/DOMWorld.js:112:20) at processTicksAndRejections (internal/process/task_queues.js:93:5) -- ASYNC -- at Frame. (/home/dietpi/Twitch-watcher/node_modules/puppeteer-core/lib/helper.js:111:15) at Page.evaluate (/home/dietpi/Twitch-watcher/node_modules/puppeteer-core/lib/Page.js:860:43) at Page. (/home/dietpi/Twitch-watcher/node_modules/puppeteer-core/lib/helper.js:112:23) at scroll (/home/dietpi/Twitch-watcher/app.js:283:16) at getAllStreamer (/home/dietpi/Twitch-watcher/app.js:246:9) at processTicksAndRejections (internal/process/task_queues.js:93:5) at async main (/home/dietpi/Twitch-watcher/app.js:360:3) (Use node --trace-warnings ... to show where the warning was created) (node:2982) 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:2982) [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.

My Raspberry Pi 4 is running Dietpi with:

PurpleMyst commented 4 years ago

This should be fixed in my fork, which you can find at https://github.com/PurpleMyst/Valorant-watcher, becasue I check for an element's existance before trying to scroll it into view ( https://github.com/PurpleMyst/Valorant-watcher/blob/master/app.ts#L447-L450 )