alexbelgium / hassio-addons

My homeassistant addons
MIT License
1.46k stars 209 forks source link

šŸ› [Epic Games Free] Can't access screenshot when e.g. login fails #597

Closed MaxWinterstein closed 1 year ago

MaxWinterstein commented 1 year ago

Which addon?

Describe the bug

When a login error happens the tool itself creates a screenshot for debugging purpose. This is saved inside the config folder /usr/app/config.

To Reproduce

Use wrong email address for login

Full addon log

Starting...
/etc/cont-init.d/00-banner.sh: executing
-----------------------------------------------------------
 Add-on: Epic Games Free
 Automatically login and redeem promotional free games from Epic Games Store
-----------------------------------------------------------
 Add-on version: 80a651a060bb4c2313886bfa4bbffb7a0683b028-2022-12-07
 You are running the latest version of this add-on.
 System: Debian GNU/Linux 11 (bullseye)  (aarch64 / raspberrypi4-64)
 Home Assistant Core: 2022.12.3
 Home Assistant Supervisor: 2022.11.2
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums
 https://github.com/alexbelgium/hassio-addons
-----------------------------------------------------------
/etc/cont-init.d/20-folders.sh: executing
/etc/cont-init.d/99-run.sh: executing
[10:21:20] INFO: The following json files were found in /config/addons_config/epicgamesfree and will be used in the app. Changing those files will require to restart the addon.
... processing config.json

[10:21:20] INFO: Starting the app
> epicgames-freegames-node@4.1.0 entrypoint-config
> node dist/src/entrypoint-config.js
Setting timezone: Europe/Berlin
Run on startup: true
[2022-12-12 10:21:29.183 +0100] INFO: Started epicgames-freegames-node
    COMMIT_SHA: "80a651a060bb4c2313886bfa4bbffb7a0683b028"
    BRANCH: "master"
    DISTRO: "alpine"
[2022-12-12 10:21:29.712 +0100] INFO: Checking free games for XXX
    user: "XXX"
[2022-12-12 10:22:14.703 +0100] ERROR: Encountered an error during browser automation. Saved a screenshot for debugging purposes.
    user: "XXX"
    errorFile: "error-2022-12-12T09:22:03.480Z.png"
[2022-12-12 10:22:14.792 +0100] ERROR: Navigation timeout of 30000 ms exceeded
    user: "XXX"
    err: {
      "type": "TimeoutError",
      "message": "Navigation timeout of 30000 ms exceeded",
      "stack":
          TimeoutError: Navigation timeout of 30000 ms exceeded
              at LifecycleWatcher._LifecycleWatcher_createTimeoutPromise (/usr/app/node_modules/puppeteer/src/common/LifecycleWatcher.ts:220:12)
      "name": "TimeoutError"
    }
[2022-12-12 10:22:14.908 +0100] WARN: Current version
    COMMIT_SHA: "80a651a060bb4c2313886bfa4bbffb7a0683b028"
    BRANCH: "master"
    DISTRO: "alpine"
Run once: false
Setting cron schedule as 5 16 * * *

Full addon config

System

doesn't matter


I quickly dived through the code of https://github.com/alexbelgium/hassio-addons/blob/master/epicgamesfree/rootfs/etc/cont-init.d/99-run.sh

Would't it bee easier to just symlink the config folder instead copying stuff?

alexbelgium commented 1 year ago

Hi, it would indeed be easier, but symlinks don't work with a docker mapped folder, and the upstream container already maps this folder...

https://github.com/claabs/epicgames-freegames-node/blob/80a651a060bb4c2313886bfa4bbffb7a0683b028/Dockerfile#L85

Alternative is to change the HOME directory to one not already mapped to allow the symlinks. I'll copy the addon in my test repo to do some tests

Symlinks create other issues, such as with permissions or such

alexbelgium commented 1 year ago

I think I've got it. I'll push a new version later today called "DONOTUPDATE", could you please update and check if everything works as expected ? On theory you don't have to change anything, it will just pick up the /config/addons_config/epicgamesfree folder as real config folder (and therefore add the screenshots in it)

MaxWinterstein commented 1 year ago

image

Works great!

alexbelgium commented 1 year ago

Great that it works, enjoy!