TheNetsky / Microsoft-Rewards-Script

Automated Microsoft Rewards script, using TypeScript, Cheerio and Playwright.
133 stars 33 forks source link

Target page, context or browser has been closed #79

Closed royaltongue closed 3 months ago

royaltongue commented 4 months ago

Running on Ubuntu 22.04 with one account, it will search normally for a while and then throw this error

[3/5/2024, 12:57:52 PM] [PID: 14805] [LOG] [MAIN] Unable to complete mobile searches, bad User-Agent? Retrying...
[3/5/2024, 12:57:53 PM] [PID: 14805] [LOG] [BROWSER] Created browser with User-Agent: "Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Mobile Safari/537.36 EdgA/121.0.0.0"
[3/5/2024, 12:57:53 PM] [PID: 14805] [LOG] [MAIN] Starting MOBILE browser
[3/5/2024, 12:57:56 PM] [PID: 14805] [LOG] [LOGIN] Already logged in
[3/5/2024, 12:57:56 PM] [PID: 14805] [LOG] [LOGIN-BING] Verifying Bing login
[3/5/2024, 12:58:02 PM] [PID: 14805] [LOG] [LOGIN-BING] Bing login verification passed!
[3/5/2024, 12:58:02 PM] [PID: 14805] [LOG] [LOGIN] Logged in successfully
[3/5/2024, 12:58:12 PM] [PID: 14805] [LOG] [GO-HOME] Visited homepage successfully
[3/5/2024, 12:58:22 PM] [PID: 14805] [LOG] [GO-HOME] Visited homepage successfully
[3/5/2024, 12:58:22 PM] [PID: 14805] [LOG] [SEARCH-BING] Starting bing searches
[3/5/2024, 12:58:24 PM] [PID: 14805] [LOG] [SEARCH-GOOGLE-TRENDS] Generating search queries, can take a while! | GeoLocale: US
[3/5/2024, 12:58:25 PM] [PID: 14805] [LOG] [SEARCH-BING] 15 Points Remaining | Query: arsenal | Mobile: true
[3/5/2024, 12:58:52 PM] [PID: 14805] [LOG] [SEARCH-BING] 15 Points Remaining | Query: yuzu | Mobile: true
[3/5/2024, 12:59:17 PM] [PID: 14805] [LOG] [SEARCH-BING] 15 Points Remaining | Query: dogecoin | Mobile: true
[3/5/2024, 12:59:44 PM] [PID: 14805] [LOG] [SEARCH-BING] 10 Points Remaining | Query: coinbase | Mobile: true
[3/5/2024, 1:00:10 PM] [PID: 14805] [LOG] [SEARCH-BING] 10 Points Remaining | Query: haiti | Mobile: true
[3/5/2024, 1:00:39 PM] [PID: 14805] [LOG] [SEARCH-BING] 10 Points Remaining | Query: joshua jackson | Mobile: true
[3/5/2024, 1:01:08 PM] [PID: 14805] [LOG] [SEARCH-BING] 5 Points Remaining | Query: celtics | Mobile: true
[3/5/2024, 1:01:36 PM] [PID: 14805] [LOG] [SEARCH-BING] Completed searches
[3/5/2024, 1:01:39 PM] [PID: 14805] [LOG] [MAIN-POINTS] The script collected 130 points today
[3/5/2024, 1:01:39 PM] [PID: 14805] [ERROR] [GET-EARNABLE-POINTS] An error occurred:Error: page.reload: Target page, context or browser has been closed
node:internal/process/promises:289
            triggerUncaughtException(err, true /* fromPromise */);
            ^

[UnhandledPromiseRejection: 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(). The promise rejected with the reason "undefined".] {
  code: 'ERR_UNHANDLED_REJECTION'
}

Node.js v21.6.1
TheNetsky commented 4 months ago

And this is constant or sometimes?

royaltongue commented 4 months ago

It only happens sometimes. If I re-run the script, it will continue where it left off (I think), but sometimes it can crash again and sometimes it will finish everything

TheNetsky commented 4 months ago

Weird, almost doesn't seem possible when I look at the code. Furthermore never had this happen. How many accounts are you using?

royaltongue commented 4 months ago

I'm running just one account right now

serzak51 commented 4 months ago

I also often have this issue, but i run with 5 accounts. I don't think it's tied to a particular account, though usually i just restart the script

royaltongue commented 3 months ago

This issue was closed? I'm still getting this error on 1.4.5

[4/2/2024, 10:28:18 PM] [PID: 250131] [LOG] [URL-REWARD] Trying to complete UrlReward
[4/2/2024, 10:28:18 PM] [PID: 250131] [LOG] [URL-REWARD] Completed the UrlReward successfully
[4/2/2024, 10:28:30 PM] [PID: 250131] [LOG] [GO-HOME] Visited homepage successfully
[4/2/2024, 10:28:30 PM] [PID: 250131] [LOG] [PUNCH-CARD] All items for punchcard: "Make smart choices for earth" have been completed
[4/2/2024, 10:28:30 PM] [PID: 250131] [LOG] [PUNCH-CARD] All "Punch Card" items have been completed
[4/2/2024, 10:28:30 PM] [PID: 250131] [LOG] [SEARCH-BING] Starting bing searches
node:internal/process/promises:289
            triggerUncaughtException(err, true /* fromPromise */);
            ^

page.reload: Target page, context or browser has been closed
    at BrowserFunc.getDashboardData (/home/z0oinks/Documents/ms-rewards/dist/browser/BrowserFunc.js:69:33)
    at BrowserFunc.getSearchPoints (/home/z0oinks/Documents/ms-rewards/dist/browser/BrowserFunc.js:97:42)
    at Search.doSearch (/home/z0oinks/Documents/ms-rewards/dist/functions/activities/Search.js:18:58)
    at async Activities.doSearch (/home/z0oinks/Documents/ms-rewards/dist/functions/Activities.js:13:13)
    at async MicrosoftRewardsBot.Desktop (/home/z0oinks/Documents/ms-rewards/dist/index.js:134:13)
    at async MicrosoftRewardsBot.runTasks (/home/z0oinks/Documents/ms-rewards/dist/index.js:83:13)
TheNetsky commented 3 months ago

I'm unable to replicate this issue, and as far as I know no other users seem to have this issue.

So until I can replicate this issue, I will not look further into this.

markschrik commented 2 months ago

I have the same issue. Exact error, only difference is file path.

[5/17/2024, 2:50:16 PM] [PID: 12260] [LOG] [SEARCH-BING] Starting bing searches
node:internal/process/promises:289
            triggerUncaughtException(err, true /* fromPromise */);
            ^

page.reload: Target page, context or browser has been closed
    at BrowserFunc.getDashboardData (C:\jsfarmer\dist\browser\BrowserFunc.js:69:33)
    at BrowserFunc.getSearchPoints (C:\jsfarmer\dist\browser\BrowserFunc.js:97:42)
    at Search.doSearch (C:\jsfarmer\dist\functions\activities\Search.js:18:58)
    at async Activities.doSearch (C:\jsfarmer\dist\functions\Activities.js:13:13)
    at async MicrosoftRewardsBot.Desktop (C:\jsfarmer\dist\index.js:134:13)
    at async MicrosoftRewardsBot.runTasks (C:\jsfarmer\dist\index.js:83:13)

Node.js v20.13.1