TychoTheTaco / Twitch-Drops-Bot

A Node.js bot that will automatically watch Twitch streams and claim drop rewards.
MIT License
279 stars 36 forks source link

[Bug] Crash after Raid #129

Open dodgex opened 2 years ago

dodgex commented 2 years ago

Describe the bug I just realized that my bot was gone. when checking the logs i found that it crashed after a raid it seems. I have gronkh in broadcasters list, thats why the bot watched the channel. He most likely was the only one online from that list until he did the raid.

Logs

[2022-06-14 01:20:22] [debug] url mismatch: https://www.twitch.tv/knuust_de?referrer=raid vs https://www.twitch.tv/gronkh
[2022-06-14 01:20:22] [info] Stream went down
[2022-06-14 01:20:23] [error] Error: net::ERR_ABORTED at about:blank
    at navigate (/app/node_modules/puppeteer/lib/cjs/puppeteer/common/FrameManager.js:164:23)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async FrameManager.navigateFrame (/app/node_modules/puppeteer/lib/cjs/puppeteer/common/FrameManager.js:141:21)
    at async Frame.goto (/app/node_modules/puppeteer/lib/cjs/puppeteer/common/FrameManager.js:541:16)
    at async Page.goto (/app/node_modules/puppeteer/lib/cjs/puppeteer/common/Page.js:1200:16)
TychoTheTaco commented 2 years ago

Do you have the full logs? This looks like a network connection issue.

dodgex commented 2 years ago

Unfortunately I cleared the log files already. But the other messages where just the usual logs about no active campaign and watching listed broadcaster. If any of the messages would by any means have looked like they where related i would have them included. :)

It might have been some quirks with twitch and raiding. or something.

dodgex commented 2 years ago

Just got this issue again tonight. This time with more log, but as the last time, the other logs are not related to the issue.

Again someone of my broadcasters list raided some one and the bot crashed. :(

[2022-06-21 23:46:01] [debug] PONG
[2022-06-21 23:50:01] [debug] PONG
[2022-06-21 23:54:01] [debug] PONG
[2022-06-21 23:58:01] [debug] PONG
[2022-06-21 23:58:28] [debug] Updating drop campaigns...
[2022-06-21 23:58:29] [debug] Found 89 campaigns.
[2022-06-21 23:58:52] [debug] Found 0 pending campaigns.
[2022-06-22 00:00:28] [info] Claimed community points!
[2022-06-22 00:02:01] [debug] PONG
[2022-06-22 00:06:01] [debug] PONG
[2022-06-22 00:10:01] [debug] PONG
[2022-06-22 00:13:29] [debug] Updating drop campaigns...
[2022-06-22 00:13:29] [debug] Error checking twitch drops: TypeError: Cannot read properties of undefined (reading 'discord')
[2022-06-22 00:14:01] [debug] PONG
[2022-06-22 00:15:28] [info] Claimed community points!
[2022-06-22 00:18:01] [debug] PONG
[2022-06-22 00:22:01] [debug] PONG
[2022-06-22 00:26:01] [debug] PONG
[2022-06-22 00:28:29] [debug] Updating drop campaigns...
[2022-06-22 00:28:30] [debug] Found 90 campaigns.
[2022-06-22 00:28:53] [debug] Found 0 pending campaigns.
[2022-06-22 00:30:01] [debug] PONG
[2022-06-22 00:30:27] [info] Claimed community points!
[2022-06-22 00:34:01] [debug] PONG
[2022-06-22 00:38:01] [debug] PONG
[2022-06-22 00:42:01] [debug] PONG
[2022-06-22 00:43:30] [debug] Updating drop campaigns...
[2022-06-22 00:43:30] [debug] Found 90 campaigns.
[2022-06-22 00:43:54] [debug] Found 0 pending campaigns.
[2022-06-22 00:45:28] [info] Claimed community points!
[2022-06-22 00:46:01] [debug] PONG
[2022-06-22 00:50:01] [debug] PONG
[2022-06-22 00:54:01] [debug] PONG
[2022-06-22 00:55:34] [debug] url mismatch: https://www.twitch.tv/pointcrow?referrer=raid vs https://www.twitch.tv/majijej
[2022-06-22 00:55:34] [info] Stream went down
[2022-06-22 00:55:35] [error] Error: net::ERR_ABORTED at about:blank
    at navigate (/app/node_modules/puppeteer/lib/cjs/puppeteer/common/FrameManager.js:164:23)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async FrameManager.navigateFrame (/app/node_modules/puppeteer/lib/cjs/puppeteer/common/FrameManager.js:141:21)
    at async Frame.goto (/app/node_modules/puppeteer/lib/cjs/puppeteer/common/FrameManager.js:541:16)
    at async Page.goto (/app/node_modules/puppeteer/lib/cjs/puppeteer/common/Page.js:1200:16)
dodgex commented 2 years ago

when another streamer from the broadcast list is online, it seems to be no problem when a stream goes "down" with a raid. :)

[2022-06-22 22:57:59] [debug] PONG
[2022-06-22 23:01:37] [debug] url mismatch: https://www.twitch.tv/pointcrow?referrer=raid vs https://www.twitch.tv/majijej
[2022-06-22 23:01:37] [info] Stream went down
[2022-06-22 23:01:37] [info] No drop campaigns active, watching a stream instead.
[2022-06-22 23:01:40] [info] stream: https://www.twitch.tv/veritas
[2022-06-22 23:01:40] [debug] target: null
[2022-06-22 23:01:41] [debug] PONG
[2022-06-22 23:01:42] [info] Waiting for page to load...
[2022-06-22 23:01:49] [info] Set stream to lowest quality
[2022-06-22 23:05:41] [debug] PONG
dodgex commented 2 years ago

it for sure is not a connectivity problem it happened this night again (exact same stacktrace) with a host to a non listed streamer and no listed one online.

to not spam this issue anymore i won't report more incidents unless the stacktrace changes or you request more information.

thank you for this nice tool!

yukaiin commented 2 years ago

same problem for me

TychoTheTaco commented 2 years ago

I have only been able to reproduce this a couple of times and it seems to be some sort of race condition. Somehow the loading of about:blank is getting canceled by the loading of the new stream after the raid (even though the new raid should be loading first and the loading of about:blank should be instantaneous).

I updated to the latest puppeteer version and haven't been able to reproduce it with that yet, so give that a try.

dodgex commented 2 years ago

This issue still exist with the version 1.2.2, does this one contain the updated puppeteer version?

[2022-07-12 23:12:32] [debug] PONG
[2022-07-12 23:15:06] [debug] Updating drop campaigns...
[2022-07-12 23:15:06] [debug] Found 60 campaigns.
[2022-07-12 23:15:23] [debug] Found 0 pending campaigns.
[2022-07-12 23:16:32] [debug] PONG
[2022-07-12 23:19:25] [debug] url mismatch: https://www.twitch.tv/h3llomarc?referrer=raid vs https://www.twitch.tv/majijej
[2022-07-12 23:19:25] [info] Stream went down
[2022-07-12 23:19:25] [error] Error: net::ERR_ABORTED at about:blank
    at navigate (/app/node_modules/puppeteer/lib/cjs/puppeteer/common/FrameManager.js:194:23)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async FrameManager.navigateFrame (/app/node_modules/puppeteer/lib/cjs/puppeteer/common/FrameManager.js:170:21)
    at async Frame.goto (/app/node_modules/puppeteer/lib/cjs/puppeteer/common/FrameManager.js:583:16)
    at async Page.goto (/app/node_modules/puppeteer/lib/cjs/puppeteer/common/Page.js:977:16)
TychoTheTaco commented 2 years ago

Yea it does have the updated version, but you're right it does still happen. It's only happened to me twice the past 2 weeks so it's been hard to find the issue but I think I know why it happens now so hopefully will have a fix soon.