Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[gog] 'gog failed: Cannot read properties of null (reading '1')' #398

Open
shinji257 opened this issue Nov 2, 2024 · 7 comments
Open

[gog] 'gog failed: Cannot read properties of null (reading '1')' #398

shinji257 opened this issue Nov 2, 2024 · 7 comments

Comments

@shinji257
Copy link

No description provided.

@FluffyClaws
Copy link

Did you know that the more info on an issue is provided the more easily it is to locate and fix?

Nevertheless, I did encounter the same error, BUT, after running the script the second time after claiming the game.

Full error looks like following:

TypeError: Cannot read properties of null (reading '1')
    at file:///free-games-claimer/gog.js:102:62

So I would assume the issue is that on the consecutive runs the matching text is not found returning null, and attempting to access [1] on the null value.

const title = text.match(/Claim (.*) and don't miss the/)[1];

I`ve never encountered this before personally, and I run the script twice each time, so most likely the are some changes on the GoG website that have caused this. Not sure how to test without a giveaway though.

@vinnymac
Copy link

I can confirm this happens after there are no more games to claim, so likely a change on the site occurred. If a game is available to claim it works just fine.

@jordyamc
Copy link

jordyamc commented Nov 20, 2024

I changed it to this to fix this error

- const title = text.match(/Claim (.*) and don't miss the/)[1];
+ const match_all = text.match(/Claim (.*) and don't miss the|Success! (.*) was added to/);
+ const title = match_all[1] ? match_all[1] : match_all[2];

@silkyclouds
Copy link

Can we eventually get a fix in the docker image based on @jordyamc comment ? I'm getting this error message as well and would like to get rid of it.
'gog failed: Cannot read properties of null (reading '1')'

@NeoMod
Copy link

NeoMod commented Dec 14, 2024

@jordyamc Thank you! 👍

@depau
Copy link

depau commented Dec 15, 2024

I changed it to this to fix this error

- const title = text.match(/Claim (.*) and don't miss the/)[1];
+ const match_all = text.match(/Claim (.*) and don't miss the|Success! (.*) was added to/);
+ const title = match_all[1] ? match_all[1] : match_all[2];

@jordyamc
Can you please submit a pull request?

AgentTechnoman added a commit to AgentTechnoman/free-games-claimer that referenced this issue Dec 19, 2024
@AgentTechnoman
Copy link

AgentTechnoman commented Dec 19, 2024

@depau
#411

Edit: Log output from container a including @jordyamc fix:

[+] Running 1/0
 ✔ Container FreeGamesClaimer  Created
Attaching to FreeGamesClaimer
FreeGamesClaimer  | Version: https://github.com/vogler/free-games-claimer/tree/
FreeGamesClaimer  | Build:
FreeGamesClaimer  | Xvfb display server created screen with resolution 1920x1080
FreeGamesClaimer  | VNC is running on port 5900 (no password!)
FreeGamesClaimer  | noVNC (VNC via browser) is running on http://localhost:6080
FreeGamesClaimer  |
FreeGamesClaimer  | 2024-12-19 23:52:38.747 started checking epic-games
FreeGamesClaimer  | Adding webgl.disabled to /fgc/data/browser/prefs.js
FreeGamesClaimer  | Signed in as **************
FreeGamesClaimer  | Free games: [ 'https://store.epicgames.com/en-US/p/vampire-survivors-f699a1' ]
FreeGamesClaimer  | Current free game: Vampire Survivors
FreeGamesClaimer  |   Already in library! Nothing to claim.
FreeGamesClaimer  | 2024-12-19 23:52:57.338 started checking prime-gaming
FreeGamesClaimer  | Signed in as **************
FreeGamesClaimer  | waitUntilStable 6671
FreeGamesClaimer  | waitUntilStable 6723
FreeGamesClaimer  | waitUntilStable 6721
FreeGamesClaimer  | waitUntilStable 6721
FreeGamesClaimer  | Number of already claimed games (total): 63
FreeGamesClaimer  | Number of free unclaimed games (Prime Gaming): 0
FreeGamesClaimer  | Number of free unclaimed games (external stores): 0
FreeGamesClaimer  | 2024-12-19 23:53:27.734 started checking gog
FreeGamesClaimer  | Signed in as **************
FreeGamesClaimer  | Current free game: Chicken Assassin: Reloaded - https://www.gog.com/en/game/chicken_assassin_reloaded
FreeGamesClaimer  |   Already in library! Nothing to claim.
FreeGamesClaimer exited with code 0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants