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

(Telegram) Notification broken (in docker)? #377

Open
silentguy256 opened this issue Sep 6, 2024 · 10 comments
Open

(Telegram) Notification broken (in docker)? #377

silentguy256 opened this issue Sep 6, 2024 · 10 comments

Comments

@silentguy256
Copy link

silentguy256 commented Sep 6, 2024

as we know epic hasn't worked for ages for me but I kind of still have it running once a week for other services and as a reminder to manually check in... A while ago notifications via telegram broke:

fgc  |
fgc  | --- Exception:
fgc  | Error: Command failed: apprise 'tgram://XXX:YYY/ZZZ' -i html -b 'epic-games: no longer signed in and not enough options set for automatic log in.'
fgc  |
fgc  |     at genericNodeError (node:internal/errors:984:15)
fgc  |     at wrappedFn (node:internal/errors:538:14)
fgc  |     at ChildProcess.exithandler (node:child_process:422:12)
fgc  |     at ChildProcess.emit (node:events:519:28)
fgc  |     at maybeClose (node:internal/child_process:1105:16)
fgc  |     at ChildProcess._handle.onexit (node:internal/child_process:305:5)
fgc  |     at Process.callbackTrampoline (node:internal/async_hooks:130:17) {
fgc  |   code: 1,
fgc  |   killed: false,
fgc  |   signal: null,
fgc  |   cmd: "apprise 'tgram://XXX:YYY/ZZZ' -i html -b 'epic-games: no longer signed in and not enough options set for automatic login.'"
fgc  | }
fgc  | error: Command failed: apprise 'tgram://XXX:YYY/ZZZ' -i html -b 'epic-games failed: Command failed: apprise 'tgram://XXX:YYY/ZZZ' -i html -b 'epic-games: no longer signed in and not enough options set for automatic login.''
fgc  |
fgc  | node:internal/errors:984
fgc  |   const err = new Error(message);
fgc  |               ^
fgc  |
fgc  | Error: Command failed: apprise 'tgram://XXX:YYY/ZZZ' -i html -b 'epic-games failed: Command failed: apprise 'tgram://XXX:YYY/ZZZ' -i html -b 'epic-games: no longer signed in and not enough options set for automatic login.''
fgc  |
fgc  |     at genericNodeError (node:internal/errors:984:15)
fgc  |     at wrappedFn (node:internal/errors:538:14)
fgc  |     at ChildProcess.exithandler (node:child_process:422:12)
fgc  |     at ChildProcess.emit (node:events:519:28)
fgc  |     at maybeClose (node:internal/child_process:1105:16)
fgc  |     at ChildProcess._handle.onexit (node:internal/child_process:305:5)
fgc  |     at Process.callbackTrampoline (node:internal/async_hooks:130:17) {
fgc  |   code: 1,
fgc  |   killed: false,
fgc  |   signal: null,
fgc  |   cmd: "apprise 'tgram://XXX:YYY/ZZZ' -i html -b 'epic-games failed: Command failed: apprise 'tgram://XXX:YYY/ZZZ' -i html -b 'epic-games: no longer signed in and not enough options set for automatic login.''"
fgc  | }

Manually triggering "apprise 'tgram://XXX:YYY/ZZZ' -i html -b 'epic-games: no longer signed in and not enough options set for automatic login.'", which i copy pasted from the error, works fine

@vogler
Copy link
Owner

vogler commented Sep 6, 2024

I had that problem once as well. Reinstalled apprise and it worked again. How did you install it? brew/apt/pip/pipx...?
Maybe your $PATH is different for an interactive shell which is why it finds apprise there.
Check type apprise to see if it's in multiple places. You can run env -i bash to get a shell without any env vars inherited, and then try to run the command from above with an absolute path to apprise to see if that works.

@silentguy256
Copy link
Author

Hm, I'm just running the docker container, usually just with "docker compose up -d" and to test it I ran it with "docker compose run free-games-claimer apprise 'tgram://..."

Starting the container not running the scripts but bash instead apprise is only in one location and it always works when called manually, with or without absolute path, also both from within env -i bash 🤷‍♂️

@vogler
Copy link
Owner

vogler commented Sep 6, 2024

Ah, ok, then it's something else. Are you running the latest image? Haven't changed anything involving apprise recently (although, could be that the apprise version changed between builds). If it's broken, it should be broken for everyone using the image.

@silentguy256
Copy link
Author

I am on the current image now, but diagnosing when the happens is a bit difficult because at first I thought I'd just check when it stopped working, which was two weeks ago, but then I noticed that that was when I was doing some maintenance to the server running it, so in theory that could be directly related, but probably that's just when I did a docker compose pull for this program, which I did not do regularly, because I thought the fact that no new releases on here ment no new docker containers...
So it could possibly be related to the last change to apprise escaping 3 months ago, but it would surprise me if no one else noticed it since then...

@Elmagenta
Copy link

I have a similar problem with gotify too, i'm also using the latest image.
Gotify server is working cause i receive notification from other services that i use.

Error: Command failed: apprise 'gotify://myip' ... (Didn't know what to cancel here so i delete all the block, but they were almost all reference to the claimed games)
06/09/2024 14:32:41
    at genericNodeError (node:internal/errors:984:15)
06/09/2024 14:32:41
    at wrappedFn (node:internal/errors:538:14)
06/09/2024 14:32:41
    at ChildProcess.exithandler (node:child_process:422:12)
06/09/2024 14:32:41
    at ChildProcess.emit (node:events:519:28)
06/09/2024 14:32:41
    at maybeClose (node:internal/child_process:1105:16)
06/09/2024 14:32:41
    at ChildProcess._handle.onexit (node:internal/child_process:305:5)
06/09/2024 14:32:41
    at Process.callbackTrampoline (node:internal/async_hooks:130:17) {
06/09/2024 14:32:41
  code: 1,
06/09/2024 14:32:41
  killed: false,
06/09/2024 14:32:41
  signal: null

@silentguy256 silentguy256 changed the title Telegram notification broken? (Telegram) Notification broken (in docker)? Sep 7, 2024
@tobiasdroste
Copy link

My gmail notifications via notify stopped working after upgrading my docker image a few days ago. Didn't change anything else about my setup.

@neoKushan
Copy link

neoKushan commented Oct 2, 2024

I'm also having the same problem with apprise, using ntfy - similar error:

error: Command failed: apprise 'ntfys://<token>@ntfy.domain.com/fgc' -i html -b 'epic-games failed: page.waitForURL: Timeout 180000ms exceeded.'

node:internal/errors:984

  const err = new Error(message);

              ^

Error: Command failed: apprise 'ntfys://<token>@ntfy.domain.com/fgc' -i html -b 'epic-games failed: page.waitForURL: Timeout 180000ms exceeded.'

    at genericNodeError (node:internal/errors:984:15)

    at wrappedFn (node:internal/errors:538:14)

    at ChildProcess.exithandler (node:child_process:422:12)

    at ChildProcess.emit (node:events:519:28)

    at maybeClose (node:internal/child_process:1105:16)

    at ChildProcess._handle.onexit (node:internal/child_process:305:5)

    at Process.callbackTrampoline (node:internal/async_hooks:130:17) {

  code: 1,

  killed: false,

  signal: null,

  cmd: "apprise 'ntfys://<token>@ntfy.domain.com/fgc' -i html -b 'epic-games failed: page.waitForURL: Timeout 180000ms exceeded.'"

This stopped working around September 15th for me. Again the command works if I log into the container directly and run it.

Using the container image for this.

@neoKushan
Copy link

So I did some digging and managed to resolve my issue with this. I'm not 100% sure what's going on here though, but I think that it's something to do with the way arguments are passed into node and ' not being escaped correctly.

In order to debug this, I modified util.js inside the container to get more output from the apprise command. I made sure -vvv was passed in and that if an error was found, both stderr and stdout were output to the console (the default logic skips both of these in the event of an error due to the return here).

Anyway, that output was crucial to understanding what was going on with apprise. Looking at the stdout, somehow this command:

apprise 'ntfys://<token>@ntfy.domain.com/fgc' -i html -b 'epic-games failed: page.waitForURL: Timeout 180000ms exceeded.'

was being treated as if the topic was fgc'. Note the ' which shouldn't be there. That topic doesn't exist on my server, so it fails to send the message, apprise exits with an error code of 1 and thus node assumes that apprise failed (Which is correct).

I checked my environment variables and noticed that I was passing in the URL like this:

        environment:
            - NOTIFY='ntfys://<token>@ntfy.domain.com/fgc'

I removed both ' from this and everything works again. But this should work fine in the first place anyway, because copying and pasting the command in the output does work, hence my thinking that fgc isn't correctly escaping the ' it's passing into execFile. I noticed there's comments in util.js talking about using execFile to avoid this very issue, so I'm not sure what's going on there.

@silentguy256 and @Elmagenta - I suspect you'll both have a similar issue as me, with apprise seeing ZZZ' instead of ZZZ - try adjusting the environment variable you're passing in like I have done and see if that helps.

@vogler It'd be really useful in future if stderr and stdout were output in the event of an error as well, as it was difficult to debug what was actually going on here without it.

@silentguy256
Copy link
Author

@silentguy256 and @Elmagenta - I suspect you'll both have a similar issue as me, with apprise seeing ZZZ' instead of ZZZ - try adjusting the environment variable you're passing in like I have done and see if that helps.

Thanks @neoKushan, I kind of expected something like this, but there was such a mess of escaping in there that I did not want to debug it, especially cause it's not always trying to send something. Changing the environment did indeed fix it! Weirdly it now sends messages as 'gog failed: Cannot read properties of null (reading '1')' instead of gog failed: Cannot read properties of null (reading '1') but that is something I can live with :)

@j-n7
Copy link

j-n7 commented Nov 1, 2024

Thank you, @neoKushan, I had the same problem and this solved it for me 👍

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

6 participants