claabs / epicgames-freegames-node

Automatically login and find available free games the Epic Games Store. Sends you a prepopulated checkout link so you can complete the checkout after logging in. Supports multiple accounts, login sessions, and scheduled runs.
https://hub.docker.com/r/charlocharlie/epicgames-freegames
MIT License
1.35k stars 92 forks source link

Session closed. Most likely the page has been closed #343

Open SilverKnightKMA opened 1 year ago

SilverKnightKMA commented 1 year ago

Describe the bug

Last week the claiming worked just fine, got the ping on discord got on the link, i do the captcha and the game is claimed. But this time it crashed. Run from source, lastest version (7dda5cbcf484f6eee15d78edd35ebbe15c2de60b).

Screenshots or Logs

F:\tools\epicgames-freegames-node>npm run start

> epicgames-freegames-node@4.1.0 start
> ts-node src/index.ts

[2023-04-24 10:18:51.926 +0700] INFO: Started epicgames-freegames-node
[2023-04-24 10:18:51.927 +0700] DEBUG: Skipping version check
    skipVersionCheck: false
[2023-04-24 10:18:51.929 +0700] DEBUG: Starting web server for captcha portals
[2023-04-24 10:18:51.935 +0700] INFO: Checking free games for REDACTED@gmail.com
    user: "REDACTED@gmail.com"
[2023-04-24 10:18:51.935 +0700] DEBUG: Launching a new browser
    user: "REDACTED@gmail.com"
[2023-04-24 10:18:52.286 +0700] DEBUG: Logging in with puppeteer
    user: "REDACTED@gmail.com"
[2023-04-24 10:18:52.286 +0700] DEBUG: Launching a new browser
    user: "REDACTED@gmail.com"
[2023-04-24 10:18:52.558 +0700] DEBUG: Launching a new page
    user: "REDACTED@gmail.com"
[2023-04-24 10:18:52.726 +0700] TRACE: devtools://devtools/bundled/inspector.html?ws=127.0.0.1:44358/devtools/page/8C81C2D2DD331F99055612D903E8D611
    user: "REDACTED@gmail.com"
[2023-04-24 10:18:55.480 +0700] ERROR: Protocol error (Target.activateTarget): Session closed. Most likely the page has been closed.
    user: "REDACTED@gmail.com"
    err: {
      "type": "Error",
      "message": "Protocol error (Target.activateTarget): Session closed. Most likely the page has been closed.",
      "stack":
          Error: Protocol error (Target.activateTarget): Session closed. Most likely the page has been closed.
              at CDPSessionImpl.send (F:\tools\epicgames-freegames-node\node_modules\puppeteer-core\src\common\Connection.ts:516:9)
              at next (F:\tools\epicgames-freegames-node\node_modules\puppeteer-extra-plugin-stealth\evasions\sourceurl\index.js:34:41)
              at CDPSessionImpl.send (F:\tools\epicgames-freegames-node\node_modules\puppeteer-extra-plugin-stealth\evasions\sourceurl\index.js:67:18)
              at CDPPage._CDPPage_screenshotTask (F:\tools\epicgames-freegames-node\node_modules\puppeteer-core\src\common\Page.ts:1382:24)
              at F:\tools\epicgames-freegames-node\node_modules\puppeteer-core\src\common\Page.ts:1374:34
              at processTicksAndRejections (node:internal/process/task_queues:95:5)

Additional context

claabs commented 1 year ago

If you're running from source, maybe you missed running npm i or npm ci in after the latest update? There were some major changes to the puppeteer and chromium versions.

SilverKnightKMA commented 1 year ago

I will try to clone and config all from scratch

SilverKnightKMA commented 1 year ago

Still got this error with new config from scratch, i will post my config.json:

{
  // "testNotifiers": true,
  "searchStrategy": "weekly",
  "runOnStartup": true,
  "cronSchedule": "5 16 * * *",
  "logLevel": "trace",
  "webPortalConfig": {
    "baseUrl": "https://epic.domain.com/",
  },
  "accounts": [
    {
      "email": "email@gmail.com",
      "password": "pw",
      "totp": "totp"
    },
    {
      "email": "email@gmail.com",
      "password": "pw",
      "totp": "totp"
    },
    {
      "email": "email@gmail.com",
      "password": "pw",
    },
  ],
  "notifiers": [
    // You may configure as many of any notifier as needed
    // Here are some examples of each type
    {
      "type": "discord",
      "webhookUrl": "https://discord.com/api/webhooks/webhook",
      // Optional list of users or roles to mention
      "mentionedUsers": ["id"],
      "mentionedRoles": ["id"],
    },
  ],
}

Steps to reproduce the bug:

  1. git clone repo
  2. create config from this file and edit information
    {
    "runOnStartup": true,
    "cronSchedule": "5 16 * * *",
    "logLevel": "info",
    "webPortalConfig": {
    "baseUrl": "https://epic.exmaple.com",
    },
    "accounts": [
    {
      "email": "example@gmail.com",
      "password": "abc1234",
      "totp": "EMNCF83ULU3K3PXPJBSWY3DPEHPK3PXPJWY3DPEHPK3YI69R39NE"
    },
    ],
    "notifiers": [
    // You may configure as many of any notifier as needed
    // Here are some examples of each type
    {
      "type": "email",
      "smtpHost": "smtp.gmail.com",
      "smtpPort": 587,
      "emailSenderAddress": "hello@gmail.com",
      "emailSenderName": "Epic Games Captchas",
      "emailRecipientAddress": "hello@gmail.com",
      "secure": false,
      "auth": {
          "user": "hello@gmail.com",
          "pass": "abc123",
      },
    },
    {
      "type": "discord",
      "webhookUrl": "https://discord.com/api/webhooks/123456789123456789/A-abcdefghijklmn-abcdefghijklmnopqrst12345678-abcdefghijklmnop123456",
      // Optional list of users or roles to mention
      "mentionedUsers": ["914360712086843432"],
      "mentionedRoles": ["734548250895319070"],
    },
    {
      "type": "telegram",
      // Optional Custom TELEGRAM server URL
      "apiUrl": "https://api.telegram.org",
      "token": "644739147:AAGMPo-Jz3mKRnHRTnrPEDi7jUF1vqNOD5k",
      "chatId": "-987654321",
    },
    {
      "type": "apprise",
      "apiUrl": "http://192.168.1.2:8000",
      "urls": "mailto://user:pass@gmail.com",
    },
    {
      "type": "pushover",
      "token": "a172fyyl9gw99p2xi16tq8hnib48p2",
      "userKey": "uvgidym7l5ggpwu2r8i1oy6diaapll",
    },
    {
      "type": "gotify",
      "apiUrl": "https://gotify.net",
      "token": "SnL-wAvmfo_QT",
    },
    {
      "type": "homeassistant",
      "instance": "https://homeassistant.example.com",
      "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c",
      "notifyservice": "mobile_app_smartphone_name",
    },
    {
      "type": "bark",
      // your bark key
      "key": "xxxxxxxxxxxxxxxxxxxxxx",
      // bark title, optional, default: 'epicgames-freegames'
      "title": "epicgames-freegames",
      // bark group, optional, default: 'epicgames-freegames'
      "group": "epicgames-freegames",
      // bark private service address, optional, default: 'https://api.day.app'
      "apiUrl": "https://api.day.app"
    },
    {
        "type": "ntfy",
        "webhookUrl": "https://ntfy.example.com/mytopic",
        "priority": "urgent",
        "token": "tk_mytoken"
    },
    ],
    }
  3. npm i
  4. npm run start
MichaelDavidGK commented 5 months ago

Same issue. config below:

  "runOnStartup": true,
  "cronSchedule": "0 0,6,12,18 * * *",
  "logLevel": "info",
  //"webPortalConfig": {
  //  "baseUrl": "https://epic.example.com",
  //},
  "accounts": [
    {
      "email": "REDACTED@gmail.com",
    },
  ],
  "notifiers": [
    // You may configure as many of any notifier as needed
    // Here are some examples of each type
    //{
    //  "type": "email",
    //  "smtpHost": "smtp.gmail.com",
    //  "smtpPort": 587,
    //  "emailSenderAddress": "hello@gmail.com",
    //  "emailSenderName": "Epic Games Captchas",
    //  "emailRecipientAddress": "hello@gmail.com",
    //  "secure": false,
    //  "auth": {
    //      "user": "hello@gmail.com",
    //      "pass": "abc123",
    //  },
    //},
    //{
    //  "type": "discord",
    //  "webhookUrl": "https://discord.com/api/webhooks/123456789123456789/A-abcdefghijklmn-abcdefghijklmnopqrst12345678-abcdefghijklmnop123456",
    //  // Optional list of users or roles to mention
    //  "mentionedUsers": ["914360712086843432"],
    //  "mentionedRoles": ["734548250895319070"],
    //},
    {
      "type": "telegram",
      // Optional Custom TELEGRAM server URL
      "apiUrl": "https://api.telegram.org",
      "token": "REDACTED:REDACTED",
      "chatId": "REDACTED",
    },
    //{
    //  "type": "apprise",
    //  "apiUrl": "http://192.168.1.2:8000",
    //  "urls": "mailto://user:pass@gmail.com",
    //},
    //{
    //  "type": "pushover",
    //  "token": "a172fyyl9gw99p2xi16tq8hnib48p2",
    //  "userKey": "uvgidym7l5ggpwu2r8i1oy6diaapll",
    //},
    //{
    //  "type": "gotify",
    //  "apiUrl": "https://gotify.net",
    //  "token": "SnL-wAvmfo_QT",
    //},
    //{
    //  "type": "homeassistant",
    //  "instance": "https://homeassistant.example.com",
    //  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c",
    //  "notifyservice": "mobile_app_smartphone_name",
    //},
    //{
    //  "type": "bark",
    //  // your bark key
    //  "key": "xxxxxxxxxxxxxxxxxxxxxx",
    //  // bark title, optional, default: 'epicgames-freegames'
    //  "title": "epicgames-freegames",
    //  // bark group, optional, default: 'epicgames-freegames'
    //  "group": "epicgames-freegames",
    //  // bark private service address, optional, default: 'https://api.day.app'
    //  "apiUrl": "https://api.day.app"
    //},
    //{
    //    "type": "ntfy",
    //    "webhookUrl": "https://ntfy.example.com/mytopic",
    //    "priority": "urgent",
    //    "token": "tk_mytoken"
    //},
    //{
    //  "type":"webhook",
    //  //url of your webhook server
    //  "url":"https://webhook.site/my_uuid",
    //  //Optional headers
    //  "headers": {
    //     "Authentication": "Bearer 123456"
    //  }
    //},
  ],
}

full error:

    user: "REDACTED@gmail.com"
    err: {
      "type": "TargetCloseError",
      "message": "Protocol error (Page.bringToFront): Session closed. Most likely the page has been closed.",
      "stack":
          TargetCloseError: Protocol error (Page.bringToFront): Session closed. Most likely the page has been closed.
              at CdpCDPSession.send (C:\epicgames-freegames-node\node_modules\puppeteer-core\src\cdp\CDPSession.ts:90:9)
              at next (C:\epicgames-freegames-node\node_modules\puppeteer-extra-plugin-stealth\evasions\sourceurl\index.js:34:41)
              at CdpCDPSession.send (C:\epicgames-freegames-node\node_modules\puppeteer-extra-plugin-stealth\evasions\sourceurl\index.js:54:18)
              at CdpPage.bringToFront (C:\epicgames-freegames-node\node_modules\puppeteer-core\src\cdp\Page.ts:963:37)
              at CdpPage.screenshot (C:\epicgames-freegames-node\node_modules\puppeteer-core\src\api\Page.ts:2448:16)
              at CdpPage.<anonymous> (C:\epicgames-freegames-node\node_modules\puppeteer-core\src\util\decorators.ts:139:27)
              at PuppetFreeGames.handlePageError (C:\epicgames-freegames-node\src\puppet\base.ts:90:7)
              at PuppetFreeGames.setupPage (C:\epicgames-freegames-node\src\puppet\base.ts:70:7)
              at PuppetFreeGames.request (C:\epicgames-freegames-node\src\puppet\free-games.ts:12:19)
              at PuppetFreeGames.getWeeklyFreeGames (C:\epicgames-freegames-node\src\puppet\free-games.ts:115:18)
      "name": "TargetCloseError"
    }
[2024-04-12 19:57:45.206 +0100] WARN: Failed to lookup catalog free games
    user: "REDACTED@gmail.com"
    err: {
      "type": "TargetCloseError",
      "message": "Protocol error (Page.bringToFront): Session closed. Most likely the page has been closed.",
      "stack":
          TargetCloseError: Protocol error (Page.bringToFront): Session closed. Most likely the page has been closed.
              at CdpCDPSession.send (C:\epicgames-freegames-node\node_modules\puppeteer-core\src\cdp\CDPSession.ts:90:9)
              at next (C:\epicgames-freegames-node\node_modules\puppeteer-extra-plugin-stealth\evasions\sourceurl\index.js:34:41)
              at CdpCDPSession.send (C:\epicgames-freegames-node\node_modules\puppeteer-extra-plugin-stealth\evasions\sourceurl\index.js:54:18)
              at CdpPage.bringToFront (C:\epicgames-freegames-node\node_modules\puppeteer-core\src\cdp\Page.ts:963:37)
              at CdpPage.screenshot (C:\epicgames-freegames-node\node_modules\puppeteer-core\src\api\Page.ts:2448:16)
              at CdpPage.<anonymous> (C:\epicgames-freegames-node\node_modules\puppeteer-core\src\util\decorators.ts:139:27)
              at PuppetFreeGames.handlePageError (C:\epicgames-freegames-node\src\puppet\base.ts:90:7)
              at PuppetFreeGames.setupPage (C:\epicgames-freegames-node\src\puppet\base.ts:70:7)
              at PuppetFreeGames.request (C:\epicgames-freegames-node\src\puppet\free-games.ts:12:19)
              at PuppetFreeGames.getCatalogFreeGames (C:\epicgames-freegames-node\src\puppet\free-games.ts:69:28)
      "name": "TargetCloseError"
    }
[2024-04-12 19:57:45.206 +0100] ERROR: Both free game API lookups failed
    user: "REDACTED@gmail.com"
    err: {
      "type": "Error",
      "message": "Both free game API lookups failed",
      "stack":
          Error: Both free game API lookups failed
              at PuppetFreeGames.getAllFreeGames (C:\epicgames-freegames-node\src\puppet\free-games.ts:352:15)
              at redeemAccount (C:\epicgames-freegames-node\src\index.ts:53:20)
              at file:///C:/epicgames-freegames-node/node_modules/p-queue/dist/index.js:187:36
    }

npm list:

+-- @tsconfig/node18@18.2.2
+-- @tsconfig/strictest@2.0.3
+-- @types/express@4.17.21
+-- @types/fs-extra@11.0.4
+-- @types/localtunnel@2.0.4
+-- @types/node@18.19.20
+-- @types/nodemailer@6.4.14
+-- @types/object-assign-deep@0.4.3
+-- @types/set-cookie-parser@2.4.7
+-- @types/tough-cookie-file-store@2.0.4
+-- @types/url-join@4.0.3
+-- @typescript-eslint/eslint-plugin@7.1.0
+-- @typescript-eslint/parser@7.1.0
+-- axios@1.6.7
+-- class-transformer@0.5.1
+-- class-validator@0.14.1
+-- copyfiles@2.4.1
+-- cron-parser@4.9.0
+-- dotenv@16.4.5
+-- eslint-config-airbnb-base@15.0.0
+-- eslint-config-airbnb-typescript@18.0.0
+-- eslint-config-prettier@9.1.0
+-- eslint-plugin-import@2.29.1
+-- eslint-plugin-prettier@5.1.3
+-- eslint@8.57.0
+-- express-async-handler@1.2.0
+-- express@4.19.2
+-- filenamify@6.0.0
+-- find-process@1.4.7
+-- fs-extra@11.2.0
+-- hashids@2.3.0
+-- json5@2.2.3
+-- localtunnel@npm:@security-patched/localtunnel@2.0.2-secpatched.3
+-- nodemailer@6.9.11
+-- object-assign-deep@0.4.0
+-- open@10.0.4
+-- otpauth@9.2.2
+-- p-queue@8.0.1
+-- p-timeout@6.1.2
+-- pidtree@0.6.0
+-- pino-pretty@10.3.1
+-- pino@8.19.0
+-- prettier@3.2.5
+-- puppeteer-extra-plugin-stealth@2.11.2
+-- puppeteer-extra@3.3.6
+-- puppeteer@22.3.0
+-- reflect-metadata@0.2.1
+-- rimraf@5.0.5
+-- set-cookie-parser@2.6.0
+-- tough-cookie-file-store@2.0.3
+-- tough-cookie@4.1.3
+-- typedoc@0.25.9
+-- typescript@5.3.3
+-- url-join@5.0.0
`-- vite-node@1.3.1