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.37k stars 93 forks source link

Config syntax error on startup #155

Closed Cexitime closed 3 years ago

Cexitime commented 3 years ago

Just updated to the latest release, The docker wont launch instead will exit, below is the log output,

epicgames-freegames-node@4.0.0 entrypoint-config /usr/app node dist/src/entrypoint-config.js

/usr/app/node_modules/json5/lib/parse.js:1083 const err = new SyntaxError(message)

SyntaxError: JSON5: invalid character '\"' at 11:5 at syntaxError (/usr/app/node_modules/json5/lib/parse.js:1083:17) at invalidChar (/usr/app/node_modules/json5/lib/parse.js:1028:12) at Object.afterPropertyValue (/usr/app/node_modules/json5/lib/parse.js:654:15) at Object.default (/usr/app/node_modules/json5/lib/parse.js:146:37) at lex (/usr/app/node_modules/json5/lib/parse.js:78:42) at Object.parse (/usr/app/node_modules/json5/lib/parse.js:25:17) at Object. (/usr/app/src/common/config/setup.ts:56:30) at Module._compile (internal/modules/cjs/loader.js:1085:14) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10) at Module.load (internal/modules/cjs/loader.js:950:32) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! epicgames-freegames-node@4.0.0 entrypoint-config: node dist/src/entrypoint-config.js npm ERR! Exit status 1

npm ERR! Failed at the epicgames-freegames-node@4.0.0 entrypoint-config script.

npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! /root/.npm/_logs/2021-10-03T02_27_45_193Z-debug.log cat: can't open '/tmp/config.json': No such file or directory cat: can't open '/tmp/config.json': No such file or directory cat: can't open '/tmp/config.json': No such file or directory cat: can't open '/tmp/config.json': No such file or directory Setting timezone: Run on startup: Run once: Exiting...

claabs commented 3 years ago

SyntaxError: JSON5: invalid character '"' at 11:5

You have an syntax error in your config.json(5) at line 11, column 5.

Cexitime commented 3 years ago

hmm, could you assist with my config file? I think I followed the conversion tutorial correctly but perhaps screwed something else up? (replaced sensitive information with X's)

{ "accounts": [ // Multiple accounts can be configured here { "email": "X@gmail.com", "password": "X", "totp": "X" }, ], "searchStrategy": "promotion" "runOnStartup": true, "timezone": "Australia/Sydney", "intervalTime": 60, "cronSchedule": "0 6 *", "runOnce": false, "logLevel": "info", "notifiers": { "type": "email", "smtpHost": "smtp.gmail.com", "smtpPort": 465, "emailSenderAddress": "X@gmail.com", "emailSenderName": "Epic Games Captchas", "emailRecipientAddress": "X@gmail.com", "secure": true, "auth": { "user": "X@gmail.com", "pass": "X", }, "webPortalConfig": { "baseUrl": "192.168:3055", } }, }

claabs commented 3 years ago

A couple things:

  1. The syntax error was a missing comma after "promotion"
  2. notifiers should be within an array
  3. Your baseUrl isn't a valid IP, but I assume that's just some redaction you did

Here's the fixed version:

{
    "accounts": [
        // Multiple accounts can be configured here
        {
            "email": "X@gmail.com",
            "password": "X",
            "totp": "X"
        },
    ],
    "searchStrategy": "promotion",
    "runOnStartup": true,
    "timezone": "Australia/Sydney",
    "intervalTime": 60,
    "cronSchedule": "0 6 * * *",
    "runOnce": false,
    "logLevel": "info",
    "notifiers": [{
        "type": "email",
        "smtpHost": "smtp.gmail.com",
        "smtpPort": 465,
        "emailSenderAddress": "X@gmail.com",
        "emailSenderName": "Epic Games Captchas",
        "emailRecipientAddress": "X@gmail.com",
        "secure": true,
        "auth": {
            "user": "X@gmail.com",
            "pass": "X",
        },
        "webPortalConfig": {
            "baseUrl": "192.168:3055", 
        }
    }],
}
Cexitime commented 3 years ago

Awesome that work thank you!

I have noticed however on the capcha portal on the email comes through as portalUrl: "http://localhost:3000 instead off the IP I specified

claabs commented 3 years ago

You placed the

"webPortalConfig": {
            "baseUrl": "192.168:3055", 
        }

block inside the notifier. Move it to the root level of the config and you should be good. Refer to the example if you get stuck.

evenwebb commented 3 years ago

@claabs Just wanted to say thanks, I had the same issue. Traced it back to the config thanks to your reply.

claabs commented 3 years ago

Let me know if there's any way I can improve the documentation for the config file. I think of most things from a developer standpoint, but I want to be sure someone with less experience can get started easily as well.

Cexitime commented 3 years ago

Thanks Claabs, I managed to get everything working, thanks for the assist and great work on the App!

Cexitime commented 3 years ago

I'm getting this error again, I don't know why it stopped working again!?

/usr/app/node_modules/json5/lib/parse.js:1083 const err = new SyntaxError(message) ^ SyntaxError: JSON5: invalid character '\"' at 19:5 at syntaxError (/usr/app/node_modules/json5/lib/parse.js:1083:17) at invalidChar (/usr/app/node_modules/json5/lib/parse.js:1028:12) at Object.afterPropertyValue (/usr/app/node_modules/json5/lib/parse.js:654:15) at Object.default (/usr/app/node_modules/json5/lib/parse.js:146:37) at lex (/usr/app/node_modules/json5/lib/parse.js:78:42) at Object.parse (/usr/app/node_modules/json5/lib/parse.js:25:17) at Object. (/usr/app/src/common/config/setup.ts:56:30) at Module._compile (internal/modules/cjs/loader.js:1085:14) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10) at Module.load (internal/modules/cjs/loader.js:950:32) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! epicgames-freegames-node@4.0.0 entrypoint-config: node dist/src/entrypoint-config.js npm ERR! Exit status 1

npm ERR! Failed at the epicgames-freegames-node@4.0.0 entrypoint-config script.

npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! /root/.npm/_logs/2021-10-07T04_45_03_500Z-debug.log cat: can't open '/tmp/config.json': No such file or directory cat: can't open '/tmp/config.json': No such file or directory cat: can't open '/tmp/config.json': No such file or directory cat: can't open '/tmp/config.json': No such file or directory Setting timezone: Run on startup: Run once: Exiting...

Here's the config again: { "accounts": [ { "email": "x@gmail.com", "password": "x", "totp": "xx", }, ], "searchStrategy": "promotion", "runOnStartup": true, "timezone": "Australia/x", "intervalTime": 60, "cronSchedule": "0 6 *", "runOnce": false, "logLevel": "info", "webPortalConfig": { "baseUrl": "192.168.1.9:3055", } "notifiers": [ { "type": "email", "smtpHost": "smtp.gmail.com", "smtpPort": 465, "emailSenderAddress": "x@gmail.com", "emailSenderName": "Epic Games Captchas", "emailRecipientAddress": x@gmail.com", "secure": true, "auth": { "user": "x@gmail.com", "pass": "x", }, },

],

}

claabs commented 3 years ago

Again, you're just missing a comma on line 19. Try opening the JSON file in an IDE like VS Code and it will help show where the syntax errors are.

Cexitime commented 3 years ago

Oh how frustrating! I have solved it, I also encountered another error of a 'not a valid web address', solved this by putting http in front of the IP address for the web url and now everything is working nicely :)

Hopefully I wont break anything else by missing a comma.