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 2FA bug, when connection drops and comes back #5587

Closed
mikeleblank opened this issue Nov 27, 2023 · 8 comments
Closed

Telegram 2FA bug, when connection drops and comes back #5587

mikeleblank opened this issue Nov 27, 2023 · 8 comments

Comments

@mikeleblank
Copy link

The moment I lose the Telegram service it tries to send me a notification and it remains in a queue, when the service returns it does not send it. The login 2FA is not sent until restarting.

In this case it is resolved by restarting the meshcentral server or service.

@si458
Copy link
Collaborator

si458 commented Nov 27, 2023

do you get any errors inside mesherrors.txt at all when telegram is DOWN and you ask for a 2FA code?

@si458
Copy link
Collaborator

si458 commented Nov 27, 2023

ok found a work around for you to try
the is a hidden value for telegram which isnt documented (will add it in)
connectionRetries which is a default value of 5 retries, every 1 second (so only tries for 5 seconds then gives up)
set connectionRetries to a high value say 60 (this should retry every 1 seconds for 60 seconds)
you can set it to a higher value but the docs recommend against this!
https://gram.js.org/beta/interfaces/client.telegramBaseClient.TelegramClientParams.html#connectionRetries

might also add another value retryDelay into the config.json which will allow you to try specify how often to try reconnecting rather than every 1 second by default!
https://gram.js.org/beta/interfaces/client.telegramBaseClient.TelegramClientParams.html#retryDelay

@mikeleblank
Copy link
Author

I don't have the error log, I checked and I have the path "meshErrorLogPath" set correctly. If I have the login logs

Activate error logs to see them directly from the mesh, when it happens again I will review it.

@mikeleblank
Copy link
Author

ok found a work around for you to try the is a hidden value for telegram which isnt documented (will add it in) connectionRetries which is a default value of 5 retries, every 1 second (so only tries for 5 seconds then gives up) set connectionRetries to a high value say 60 (this should retry every 1 seconds for 60 seconds) you can set it to a higher value but the docs recommend against this! https://gram.js.org/beta/interfaces/client.telegramBaseClient.TelegramClientParams.html#connectionRetries

might also add another value retryDelay into the config.json which will allow you to try specify how often to try reconnecting rather than every 1 second by default! https://gram.js.org/beta/interfaces/client.telegramBaseClient.TelegramClientParams.html#retryDelay

I test and report

@si458
Copy link
Collaborator

si458 commented Nov 27, 2023

OOO just re-read the docs
How many times the reconnection should retry, either on the initial connection or when Telegram disconnects us.
May be set to a negative or undefined value for infinite retries, but this is not recommended, since the program can get stuck in an infinite loop. defaults to 5

you should be able to set the value of connectionRetries to say -1 and it will always retry

si458 added a commit that referenced this issue Nov 27, 2023
Signed-off-by: si458 <simonsmith5521@gmail.com>
@si458 si458 removed the docs label Nov 27, 2023
@mikeleblank
Copy link
Author

OOO just re-read the docs How many times the reconnection should retry, either on the initial connection or when Telegram disconnects us. May be set to a negative or undefined value for infinite retries, but this is not recommended, since the program can get stuck in an infinite loop. defaults to 5 you should be able to set the value of connectionRetries to say -1 and it will always retry

i set value -1 but service telegram bot not started

@si458
Copy link
Collaborator

si458 commented Nov 27, 2023

OOO just re-read the docs How many times the reconnection should retry, either on the initial connection or when Telegram disconnects us. May be set to a negative or undefined value for infinite retries, but this is not recommended, since the program can get stuck in an infinite loop. defaults to 5 you should be able to set the value of connectionRetries to say -1 and it will always retry

i set value -1 but service telegram bot not started

bummer! what about a high value then like say 300 (which would be 300 sec/5mins) ?

EDIT: where are you also placing the connectionRetries value? it should be inside the telegram object in config.json

@mikeleblank
Copy link
Author

"messaging": {
"telegram": {
"apiid": XX,
"apihash": "XX",
"bottoken": "XX",
"connectionRetries": 6000,
"retryDelay":3000
}
}

working perfectly

@si458 si458 closed this as completed Dec 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants