NiciusB / twitch-drops-lurker

Get twitch drops without the hassle of having a tab open
17 stars 4 forks source link

Timeout Error #9

Open TomasCorral opened 3 years ago

TomasCorral commented 3 years ago

Hi,

I'm trying to use the bot for rust drops an I'm getting a timeout exception

Error: TimeoutError: Navigation timeout of 30000 ms exceeded

The bot used to work in the past on another virtual machine of mine, I'm using a new ubunto 18.04 server with google-chrome-stable package.

NiciusB commented 3 years ago

Hey @XxTopKillerzZ can you post the whole log? So that I can figure out where the error is occurring.

I'm guessing the error fires just after 🔍 Looking for a streamer to watch

mt025 commented 3 years ago

I have the same issue, though I'm using chromium on raspberry pi 4.

pi@J-Pi:~/scripts/twitchidle/twitch-drops-lurker$ node index.js
Monitoring webserver listening at http://localhost:5000
(node:2780) UnhandledPromiseRejectionWarning: TimeoutError: Navigation timeout of 30000 ms exceeded
    at Promise.then (/home/pi/scripts/twitchidle/twitch-drops-lurker/node_modules/puppeteer-core/lib/LifecycleWatcher.js:142:21)
  -- ASYNC --
    at Frame.<anonymous> (/home/pi/scripts/twitchidle/twitch-drops-lurker/node_modules/puppeteer-core/lib/helper.js:111:15)
    at Page.goto (/home/pi/scripts/twitchidle/twitch-drops-lurker/node_modules/puppeteer-core/lib/Page.js:672:49)
    at Page.<anonymous> (/home/pi/scripts/twitchidle/twitch-drops-lurker/node_modules/puppeteer-core/lib/helper.js:112:23)
    at preparePage (/home/pi/scripts/twitchidle/twitch-drops-lurker/src/puppeteerPage.js:43:14)
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:2780) 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:2780) [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.

There seems to be a widespread issue with chrome headless mode, making it take 10-40x longer - https://github.com/codeceptjs/CodeceptJS/issues/561

Firstly, it works fine with headless: false in puppeteerPage.js.

I have tried some of the solutions in https://github.com/codeceptjs/CodeceptJS/issues/561, such as setting a user agent and disabling proxy discovery, however none have worked me. Increasing the timeout of page.goto works await page.goto('https://twitch.tv/',{ timeout: 999999, waitUntil: "domcontentloaded" }), but thats not really the solution here.

However, surprisingly, removing the userDataDir: './puppeteer_tmp' or changing to the full path userDataDir: '/home/pi/scripts/twitchidle/v2/twitch-drops-lurker/puppeteer_tmp' works perfectly for me.

It seems chrome has an issue with using ./ in the command line when headless from my above findings. Leaving the datadir unset is the solution for me as the new datadir is /tmp/puppeteer_dev_chrome_profile-iy3AA5