mautrix / telegram

A Matrix-Telegram hybrid puppeting/relaybot bridge
https://matrix.to/#/#telegram:maunium.net
GNU Affero General Public License v3.0
1.33k stars 174 forks source link

Bridge and user are being kicked #733

Open hooger opened 2 years ago

hooger commented 2 years ago

Hello all, I setup the telegram bridge a couple of weeks back and it was working fine, I was chatting on it with a friend. I checked the bridge after about a week and ping said that "You were logged in, but there appears to have been an error". When I login I get the link in the bridge (via matrix), click on the link, fill in my phone number and get the SMS. After typing, the bridge says that login was successful. However, it does not take long. After a couple of minutes I got kicked, just like the account on my android VM. I have no phone, that is why I had to setup an Android VM. The VM is created based on this: https://docs.mau.fi/bridges/go/whatsapp/android-vm-setup.html The used android image is "system-images;android-28;google_apis_playstore;x86" What I see in the logs:

Jan 08 15:32:39 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:32:39,396] [DEBUG@telethon.5072717513.extensions.messagepacker] Assigned msg_id = 7050858656773658996 to GetContactsRequest (7f8fe2611a00)                             
Jan 08 15:32:39 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:32:39,396] [DEBUG@telethon.5072717513.network.mtprotosender] Encrypting 1 message(s) in 28 bytes for sending                                                           
Jan 08 15:32:39 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:32:39,397] [DEBUG@telethon.5072717513.network.mtprotosender] Encrypted messages put in a queue to be sent                                                              
Jan 08 15:32:39 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:32:39,397] [DEBUG@telethon.5072717513.network.mtprotosender] Waiting for messages to send...                                                                           
Jan 08 15:32:39 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:32:39,397] [DEBUG@telethon.5072717513.extensions.messagepacker] Assigned msg_id = 7050858656779619464 to MsgsAck (7f8fb6dc3910)                                        
Jan 08 15:32:39 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:32:39,398] [DEBUG@telethon.5072717513.network.mtprotosender] Encrypting 1 message(s) in 36 bytes for sending                                                           
Jan 08 15:32:39 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:32:39,398] [DEBUG@telethon.5072717513.network.mtprotosender] Encrypted messages put in a queue to be sent                                                              
Jan 08 15:32:39 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:32:39,399] [DEBUG@telethon.5072717513.network.mtprotosender] Waiting for messages to send...                                                                           
Jan 08 15:32:39 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:32:39,454] [DEBUG@telethon.5072717513.network.mtprotosender] Handling RPC result for message 7050858656773658996                                                       
Jan 08 15:32:39 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:32:39,457] [DEBUG@telethon.5072717513.network.mtprotosender] Receiving items from the network...                                                                       
Jan 08 15:32:39 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:32:39,476] [DEBUG@mau.user.@gergely:horvath.club] Updating contacts of @gergely:horvath.club...                                                                        
Jan 08 15:32:40 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:32:40,066] [DEBUG@telethon.5072717513.extensions.messagepacker] Assigned msg_id = 7050858659748965152 to UpdateStatusRequest (7f8fb6d3e9d0)                            
Jan 08 15:32:40 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:32:40,067] [DEBUG@telethon.5072717513.network.mtprotosender] Encrypting 1 message(s) in 24 bytes for sending                                                           
Jan 08 15:32:40 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:32:40,068] [DEBUG@telethon.5072717513.network.mtprotosender] Encrypted messages put in a queue to be sent                                                              
Jan 08 15:32:40 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:32:40,069] [DEBUG@telethon.5072717513.network.mtprotosender] Waiting for messages to send...                                                                           
Jan 08 15:32:40 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:32:40,069] [DEBUG@telethon.5072717513.extensions.messagepacker] Assigned msg_id = 7050858659761168368 to MsgsAck (7f8fb70288b0)                                        
Jan 08 15:32:40 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:32:40,069] [DEBUG@telethon.5072717513.network.mtprotosender] Encrypting 1 message(s) in 36 bytes for sending                                                           
Jan 08 15:32:40 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:32:40,070] [DEBUG@telethon.5072717513.network.mtprotosender] Encrypted messages put in a queue to be sent                                                              
Jan 08 15:32:40 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:32:40,070] [DEBUG@telethon.5072717513.network.mtprotosender] Waiting for messages to send...                                                                          
Jan 08 15:32:40 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:32:40,119] [DEBUG@telethon.5072717513.network.mtprotosender] Handling RPC result for message 7050858659748965152                                                      
Jan 08 15:32:40 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:32:40,119] [DEBUG@telethon.5072717513.network.mtprotosender] Receiving items from the network...                                                                      
Jan 08 15:33:25 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:33:25,063] [DEBUG@telethon.5072717513.extensions.messagepacker] Assigned msg_id = 7050858853011245840 to PingRequest (7f8fb6d8f460)                                   
Jan 08 15:33:25 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:33:25,064] [DEBUG@telethon.5072717513.network.mtprotosender] Encrypting 1 message(s) in 28 bytes for sending                                                          
Jan 08 15:33:25 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:33:25,064] [DEBUG@telethon.5072717513.network.mtprotosender] Encrypted messages put in a queue to be sent                                                             
Jan 08 15:33:25 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:33:25,065] [DEBUG@telethon.5072717513.network.mtprotosender] Waiting for messages to send...                                                                          
Jan 08 15:33:25 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:33:25,065] [DEBUG@telethon.5072717513.extensions.messagepacker] Assigned msg_id = 7050858853018574824 to MsgsAck (7f8fb6daaf10)                                       
Jan 08 15:33:25 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:33:25,065] [DEBUG@telethon.5072717513.network.mtprotosender] Encrypting 1 message(s) in 36 bytes for sending                                                          
Jan 08 15:33:25 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:33:25,067] [DEBUG@telethon.5072717513.network.mtprotosender] Encrypted messages put in a queue to be sent                                                             
Jan 08 15:33:25 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:33:25,067] [DEBUG@telethon.5072717513.network.mtprotosender] Waiting for messages to send...
Jan 08 15:33:25 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:33:25,100] [DEBUG@telethon.5072717513.network.mtprotosender] Handling pong for message 7050858853011245840
Jan 08 15:33:25 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:33:25,101] [DEBUG@telethon.5072717513.network.mtprotosender] Receiving items from the network...
Jan 08 15:33:50 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:33:50,462] [DEBUG@telethon.5072717513.extensions.messagepacker] Assigned msg_id = 7050858961980450440 to UpdateStatusRequest (7f8fb701fb50)
Jan 08 15:33:50 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:33:50,462] [DEBUG@telethon.5072717513.network.mtprotosender] Encrypting 1 message(s) in 24 bytes for sending
Jan 08 15:33:50 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:33:50,464] [DEBUG@telethon.5072717513.network.mtprotosender] Encrypted messages put in a queue to be sent
Jan 08 15:33:50 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:33:50,465] [DEBUG@telethon.5072717513.network.mtprotosender] Waiting for messages to send...
Jan 08 15:33:50 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:33:50,465] [DEBUG@telethon.5072717513.extensions.messagepacker] Assigned msg_id = 7050858961993305968 to MsgsAck (7f8fb701f6a0)                              [397/1898]
Jan 08 15:33:50 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:33:50,465] [DEBUG@telethon.5072717513.network.mtprotosender] Encrypting 1 message(s) in 36 bytes for sending
Jan 08 15:33:50 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:33:50,466] [DEBUG@telethon.5072717513.network.mtprotosender] Encrypted messages put in a queue to be sent
Jan 08 15:33:50 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:33:50,466] [DEBUG@telethon.5072717513.network.mtprotosender] Waiting for messages to send...
Jan 08 15:33:50 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:33:50,700] [DEBUG@telethon.5072717513.network.mtprotosender] Handling RPC result for message 7050858961980450440
Jan 08 15:33:50 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:33:50,700] [DEBUG@telethon.5072717513.network.mtprotosender] Receiving items from the network...
Jan 08 15:34:17 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:34:17,946] [DEBUG@telethon.5072717513.network.mtprotosender] Handling update UpdatesTooLong
Jan 08 15:34:17 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:34:17,947] [DEBUG@telethon.5072717513.network.mtprotosender] Receiving items from the network...
Jan 08 15:34:25 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:34:25,070] [DEBUG@telethon.5072717513.extensions.messagepacker] Assigned msg_id = 7050859110735787160 to PingRequest (7f8fb6d3ecd0)
Jan 08 15:34:25 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:34:25,070] [DEBUG@telethon.5072717513.network.mtprotosender] Encrypting 1 message(s) in 28 bytes for sending
Jan 08 15:34:25 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:34:25,071] [DEBUG@telethon.5072717513.network.mtprotosender] Encrypted messages put in a queue to be sent
Jan 08 15:34:25 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:34:25,071] [DEBUG@telethon.5072717513.network.mtprotosender] Waiting for messages to send...
Jan 08 15:34:25 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:34:25,072] [DEBUG@telethon.5072717513.extensions.messagepacker] Assigned msg_id = 7050859110743376500 to MsgsAck (7f8fb6daad00)
Jan 08 15:34:25 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:34:25,072] [DEBUG@telethon.5072717513.network.mtprotosender] Encrypting 1 message(s) in 44 bytes for sending
Jan 08 15:34:25 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:34:25,073] [DEBUG@telethon.5072717513.network.mtprotosender] Encrypted messages put in a queue to be sent
Jan 08 15:34:25 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:34:25,074] [DEBUG@telethon.5072717513.network.mtprotosender] Waiting for messages to send...
Jan 08 15:34:25 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:34:25,107] [DEBUG@telethon.5072717513.network.mtprotosender] Handling pong for message 7050859110735787160
Jan 08 15:34:25 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:34:25,108] [DEBUG@telethon.5072717513.network.mtprotosender] Receiving items from the network...
Jan 08 15:34:39 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:34:39,732] [DEBUG@telethon.5072717513.extensions.messagepacker] Assigned msg_id = 7050859173515228788 to UpdateStatusRequest (7f8fb6d8f130)
Jan 08 15:34:39 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:34:39,733] [DEBUG@telethon.5072717513.network.mtprotosender] Encrypting 1 message(s) in 24 bytes for sending
Jan 08 15:34:39 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:34:39,733] [DEBUG@telethon.5072717513.network.mtprotosender] Encrypted messages put in a queue to be sent
Jan 08 15:34:39 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:34:39,733] [DEBUG@telethon.5072717513.network.mtprotosender] Waiting for messages to send...
Jan 08 15:34:39 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:34:39,734] [DEBUG@telethon.5072717513.extensions.messagepacker] Assigned msg_id = 7050859173521376172 to MsgsAck (7f8fb6dc3d30)
Jan 08 15:34:39 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:34:39,734] [DEBUG@telethon.5072717513.network.mtprotosender] Encrypting 1 message(s) in 36 bytes for sending
Jan 08 15:34:39 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:34:39,735] [DEBUG@telethon.5072717513.network.mtprotosender] Encrypted messages put in a queue to be sent
Jan 08 15:34:39 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:34:39,735] [DEBUG@telethon.5072717513.network.mtprotosender] Waiting for messages to send...
Jan 08 15:34:39 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:34:39,781] [DEBUG@telethon.5072717513.network.mtprotosender] Handling RPC result for message 7050859173515228788
Jan 08 15:34:39 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:34:39,781] [DEBUG@telethon.5072717513.network.mtprotosender] Receiving items from the network...
Jan 08 15:34:39 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:34:39,781] [DEBUG@telethon.5072717513.extensions.messagepacker] Assigned msg_id = 7050859173712133924 to MsgsAck (7f8fb6d8f5e0)
Jan 08 15:34:39 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:34:39,782] [DEBUG@telethon.5072717513.network.mtprotosender] Encrypting 1 message(s) in 36 bytes for sending
Jan 08 15:34:39 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:34:39,782] [DEBUG@telethon.5072717513.network.mtprotosender] Encrypted messages put in a queue to be sent
Jan 08 15:34:39 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:34:39,782] [DEBUG@telethon.5072717513.network.mtprotosender] Waiting for messages to send...
Jan 08 15:34:39 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:34:39,783] [DEBUG@telethon.5072717513.extensions.messagepacker] Assigned msg_id = 7050859173717268508 to MsgsAck (7f8fb6d3ecd0)
Jan 08 15:34:39 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:34:39,783] [DEBUG@telethon.5072717513.network.mtprotosender] Encrypting 1 message(s) in 36 bytes for sending
Jan 08 15:34:39 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:34:39,783] [ERROR@mau.mx] Error handling manually received Matrix event
Jan 08 15:34:39 matrix matrix-mautrix-telegram[9628]: Traceback (most recent call last):
Jan 08 15:34:39 matrix matrix-mautrix-telegram[9628]:   File "/usr/lib/python3.9/site-packages/mautrix/bridge/matrix.py", line 434, in try_handle_sync_event
Jan 08 15:34:39 matrix matrix-mautrix-telegram[9628]:     await self.handle_ephemeral_event(evt)
Jan 08 15:34:39 matrix matrix-mautrix-telegram[9628]:   File "/usr/lib/python3.9/site-packages/mautrix_telegram/matrix.py", line 359, in handle_ephemeral_event
Jan 08 15:34:39 matrix matrix-mautrix-telegram[9628]:     await self.handle_presence(evt.sender, evt.content.presence)
Jan 08 15:34:39 matrix matrix-mautrix-telegram[9628]:   File "/usr/lib/python3.9/site-packages/mautrix_telegram/matrix.py", line 320, in handle_presence
Jan 08 15:34:39 matrix matrix-mautrix-telegram[9628]:     await user.set_presence(presence == PresenceState.ONLINE)
Jan 08 15:34:39 matrix matrix-mautrix-telegram[9628]:   File "/usr/lib/python3.9/site-packages/mautrix_telegram/user.py", line 340, in set_presence
Jan 08 15:34:39 matrix matrix-mautrix-telegram[9628]:     await self.client(UpdateStatusRequest(offline=not online))
Jan 08 15:34:39 matrix matrix-mautrix-telegram[9628]:   File "/usr/lib/python3.9/site-packages/telethon/client/users.py", line 30, in __call__
Jan 08 15:34:39 matrix matrix-mautrix-telegram[9628]:     return await self._call(self._sender, request, ordered=ordered)
Jan 08 15:34:39 matrix matrix-mautrix-telegram[9628]:   File "/usr/lib/python3.9/site-packages/telethon/client/users.py", line 84, in _call
Jan 08 15:34:39 matrix matrix-mautrix-telegram[9628]:     result = await future
Jan 08 15:34:39 matrix matrix-mautrix-telegram[9628]: telethon.errors.rpcerrorlist.SessionRevokedError: The authorization has been invalidated, because of the user terminating all sessions (caused by UpdateStatusRequest)

and than it repeats itself until I send ping. Around the ping these are in the log:

Jan 08 15:42:39 matrix matrix-mautrix-telegram[9628]: Traceback (most recent call last):
Jan 08 15:42:39 matrix matrix-mautrix-telegram[9628]:   File "/usr/lib/python3.9/site-packages/mautrix/bridge/matrix.py", line 434, in try_handle_sync_event                                                                               
Jan 08 15:42:39 matrix matrix-mautrix-telegram[9628]:     await self.handle_ephemeral_event(evt)
Jan 08 15:42:39 matrix matrix-mautrix-telegram[9628]:   File "/usr/lib/python3.9/site-packages/mautrix_telegram/matrix.py", line 359, in handle_ephemeral_event                                                                            
Jan 08 15:42:39 matrix matrix-mautrix-telegram[9628]:     await self.handle_presence(evt.sender, evt.content.presence)                                                                                                                     
Jan 08 15:42:39 matrix matrix-mautrix-telegram[9628]:   File "/usr/lib/python3.9/site-packages/mautrix_telegram/matrix.py", line 320, in handle_presence                                                                                   
Jan 08 15:42:39 matrix matrix-mautrix-telegram[9628]:     await user.set_presence(presence == PresenceState.ONLINE)
Jan 08 15:42:39 matrix matrix-mautrix-telegram[9628]:   File "/usr/lib/python3.9/site-packages/mautrix_telegram/user.py", line 340, in set_presence                                                                                        
Jan 08 15:42:39 matrix matrix-mautrix-telegram[9628]:     await self.client(UpdateStatusRequest(offline=not online))
Jan 08 15:42:39 matrix matrix-mautrix-telegram[9628]:   File "/usr/lib/python3.9/site-packages/telethon/client/users.py", line 30, in __call__                                                                                             
Jan 08 15:42:39 matrix matrix-mautrix-telegram[9628]:     return await self._call(self._sender, request, ordered=ordered)                                                                                                                  
Jan 08 15:42:39 matrix matrix-mautrix-telegram[9628]:   File "/usr/lib/python3.9/site-packages/telethon/client/users.py", line 84, in _call                                                                                                
Jan 08 15:42:39 matrix matrix-mautrix-telegram[9628]:     result = await future
Jan 08 15:42:39 matrix matrix-mautrix-telegram[9628]: telethon.errors.rpcerrorlist.SessionRevokedError: The authorization has been invalidated, because of the user terminating all sessions (caused by UpdateStatusRequest)               
Jan 08 15:42:39 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:42:39,658] [DEBUG@telethon.5072717513.network.mtprotosender] Encrypted messages put in a queue to be sent                                                             
Jan 08 15:42:39 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:42:39,659] [DEBUG@telethon.5072717513.network.mtprotosender] Waiting for messages to send...                                                                          
Jan 08 15:42:48 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:42:48,989] [INFO@aiohttp.access] 172.18.0.9 [08/Jan/2022:15:42:48 +0000] "PUT /transactions/423?access_token=<TOKEN> HTTP/1.1" 200 158 "-" "Synapse/1.49.2"
Jan 08 15:42:49 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:42:49,480] [INFO@aiohttp.access] 172.18.0.9 [08/Jan/2022:15:42:49 +0000] "PUT /transactions/424?access_token=<TOKEN> HTTP/1.1" 200 158 "-" "Synapse/1.49.2"
Jan 08 15:42:49 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:42:49,899] [INFO@aiohttp.access] 172.18.0.9 [08/Jan/2022:15:42:49 +0000] "PUT /transactions/425?access_token=<TOKEN> HTTP/1.1" 200 158 "-" "Synapse/1.49.2"
Jan 08 15:42:49 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:42:49,899] [DEBUG@mau.mx] Received Matrix event $WcPVlVK4Po-ZHOZge0puJUDhRetzsH-OxdanY5o7UTY from @gergely:horvath.club in !sRODJuldQsoMjUfACu:horvath.club           
Jan 08 15:42:49 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:42:49,935] [DEBUG@telethon.5072717513.extensions.messagepacker] Assigned msg_id = 7050861278861974672 to GetUsersRequest (7f8fb6d8fa30)                               
Jan 08 15:42:49 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:42:49,936] [DEBUG@telethon.5072717513.network.mtprotosender] Encrypting 1 message(s) in 32 bytes for sending                                                          
Jan 08 15:42:49 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:42:49,936] [DEBUG@telethon.5072717513.network.mtprotosender] Encrypted messages put in a queue to be sent                                                             
Jan 08 15:42:49 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:42:49,936] [DEBUG@telethon.5072717513.network.mtprotosender] Waiting for messages to send...                                                                          
Jan 08 15:42:49 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:42:49,977] [DEBUG@telethon.5072717513.network.mtprotosender] Handling RPC result for message 7050861278861974672                                                      
Jan 08 15:42:49 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:42:49,978] [DEBUG@telethon.5072717513.network.mtprotosender] Receiving items from the network...                                                                      
Jan 08 15:42:49 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:42:49,978] [DEBUG@telethon.5072717513.extensions.messagepacker] Assigned msg_id = 7050861279032160716 to MsgsAck (7f8fb6daae20)                                       
Jan 08 15:42:49 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:42:49,978] [DEBUG@telethon.5072717513.network.mtprotosender] Encrypting 1 message(s) in 36 bytes for sending                                                          
Jan 08 15:42:49 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:42:49,978] [DEBUG@telethon.5072717513.network.mtprotosender] Encrypted messages put in a queue to be sent                                                             
Jan 08 15:42:49 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:42:49,978] [DEBUG@telethon.5072717513.network.mtprotosender] Waiting for messages to send...                                                                          
Jan 08 15:42:49 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:42:49,979] [DEBUG@telethon.5072717513.extensions.messagepacker] Assigned msg_id = 7050861279034821464 to MsgsAck (7f8fb6d27970)                                       
Jan 08 15:42:49 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:42:49,979] [DEBUG@telethon.5072717513.network.mtprotosender] Encrypting 1 message(s) in 36 bytes for sending                                                          
Jan 08 15:42:49 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:42:49,979] [ERROR@mau.user.@gergely:horvath.club] Authorization error in get_me(): The authorization has been invalidated, because of the user terminating all sessions (caused by GetUsersRequest)
Jan 08 15:42:49 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:42:49,979] [INFO@telethon.5072717513.network.mtprotosender] Disconnecting from 149.154.167.91:443/TcpFull...                                                          
Jan 08 15:42:49 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:42:49,979] [DEBUG@telethon.5072717513.network.mtprotosender] Closing current connection...                                                                            
Jan 08 15:42:49 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:42:49,980] [DEBUG@telethon.5072717513.network.mtprotosender] Cancelling 0 pending message(s)...                                                                       
Jan 08 15:42:49 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:42:49,981] [INFO@telethon.5072717513.network.mtprotosender] Disconnection from 149.154.167.91:443/TcpFull complete!                                                   
Jan 08 15:42:50 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:42:50,229] [INFO@aiohttp.access] 172.18.0.9 [08/Jan/2022:15:42:50 +0000] "PUT /transactions/426?access_token=<TOKEN> HTTP/1.1" 200 158 "-" "Synapse/1.49.2"
Jan 08 15:42:50 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:42:50,265] [INFO@aiohttp.access] 172.18.0.9 [08/Jan/2022:15:42:50 +0000] "PUT /transactions/427?access_token=<TOKEN> HTTP/1.1" 200 158 "-" "Synapse/1.49.2"
Jan 08 15:42:51 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:42:51,020] [INFO@aiohttp.access] 172.18.0.9 [08/Jan/2022:15:42:51 +0000] "PUT /transactions/428?access_token=<TOKEN> HTTP/1.1" 200 158 "-" "Synapse/1.49.2"
Jan 08 15:46:08 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:46:08,117] [INFO@aiohttp.access] 172.18.0.9 [08/Jan/2022:15:46:08 +0000] "PUT /transactions/429?access_token=<TOKEN> HTTP/1.1" 200 158 "-" "Synapse/1.49.2"
Jan 08 15:46:08 matrix matrix-mautrix-telegram[9628]: [2022-01-08 15:46:08,336] [INFO@aiohttp.access] 172.18.0.9 [08/Jan/2022:15:46:08 +0000] "PUT /transactions/430?access_token=<TOKEN> HTTP/1.1" 200 158 "-" "Synapse/1.49.2"

Any idea what can be the problem? Any help/hint is appreciated!

smith2462 commented 2 years ago

Same problem, the telegram app(phone), sign out completely by itself and the bridge Lost, after 10-15 seconds since bridge connected

hooger commented 2 years ago

I added two-factor auth, same thing happened. These logs seems like some message is stuck, is it correct?

Encrypting 1 message(s) in 36 bytes for sending
Encrypted messages put in a queue to be sent
Waiting for messages to send...
dsonck92 commented 2 years ago

I also have this issue but only on one of my 2 accounts. This also resulted in me getting a temporary restriction on my number. I'm currently waiting for that to lift, but it's a bit of a strange problem. I likely was signed out by Telegram quite some time ago without noticing but recently wanted to get back and hit by the sign-out.

hooger commented 2 years ago

Actually I don't really have any traffic on my account. I try to up it a bit from the VM by joining a group (pinephone, bad idea with its 1600 users...), and maybe sending some random stuff to another user. See what happens.

daniel-mcdonough commented 2 years ago

Having the same issue. All devices attached to the Telegram account are logged out. This does not happen when authenticating with a bot API key. Maybe Telegram is clamping down on bots using human accounts.

ndarilek commented 2 years ago

Happening to me as well. Given that my phone and the bridge VM are in different locations and on different continents, I'm wondering if there's some geolock that now happens when multiple accounts log in for the same person but from drastically different locations?

@Daniel-McDonough, you say this doesn't happen with a bot token? Just to confirm, you're using the relay bot mechanism? I.e. https://docs.mau.fi/bridges/python/telegram/relay-bot.html? I'm fairly new to Telegram, but I'm guessing that wouldn't let me chat as myself, only as the bot?

Thanks.

daniel-mcdonough commented 2 years ago

@ndarilek Correct. This does not happen when using a bot token. You chat as the bot but I'm pretty sure there is a config that allows the bot to prefix the message with your user. The bot cannot subscribe to a public channel, though, unless there is something I missed.

dsonck92 commented 2 years ago

I'll also add that, I did manage to get a bit of messages from my 2nd telegram account before discovering that it again logged out everything. It's kinda interesting how only one of my accounts is affected. I have two Telegram accounts. My main one, which receives casual talk with some family members remains totally unaffected. However, my other telegram account for other kinds of communities is hitting the issue.

One thing that just popped up in my head, I do know my 2nd account is member of a channel, whereas my main one isn't. Perhaps it's not properly handling the new changes to channels.

I might try leaving that channel (as it's actually not useful for me anyways) and see if this eliminates the issue.

ndarilek commented 2 years ago

Interesting. I'll add another data point: my account is brand new and is only subscribed to a single channel--no contacts or anything else. I'll leave the channel and try logging in again tomorrow.

daniel-mcdonough commented 2 years ago

I'll also add that, I did manage to get a bit of messages from my 2nd telegram account before discovering that it again logged out everything.

Same thing happened to me. I have maybe 2-5 minutes of messages being pulled before the deauth.

I wonder why this is not occurring with another client like Nekox.

dsonck92 commented 2 years ago

I'm also wondering why it's not occurring with another account using the exact same bridge version and mostly same configuration. Leaving the channels didn't change much, I still got logged out pretty fast.

hooger commented 2 years ago

I also experience the same, when my account was only participating in a 1on1 chat it was kicked, and later when I tested to join a channel with 1600 user, it also was kicked in about 1-5 minutes once this issue started to occur.

My account was kind of dead for about 3 years when I reactivated it to use it with the bridge. Directly after reactivation, in about 30minutes (definitely outside of the 1-5 minute margin) a friend reached out, like "hi, u using Telegram, how cool" and we chated on and off for a couple hours. Everything seemed shiny, and I checked back in a week, and the issue started. So my Telegram account hasn't seen too much of an activity, but still it shouldn't be that strict. :D

Also: IP address of the bridge is from the same country as the client VM. I also tested if the VM from my computer with the official telegram client gets banned, but it didn't happened if I wasn't using the bridge.

SpiderOnTheNet commented 2 years ago

Hi ! I got the same problems when I try to login to my Telegram account. It just work ~ 10-20 sec and it disconnect all my Telegram session for all my devices. I try to use a bot-relay, but I don't understand how it work :/ I managed to creat a bot with botfather, to connect it to the bridge with the bot_token, the command "ping-bot" show me my bot id, but I don't understand how to tchat with my Telegrams contacts... If someone can help me to use the bridge, or if someone can fix this disconnect problem, It would be amazing ! ;)

Cerothen commented 2 years ago

I have also been having this issue, with the app local to the server (eg same IP address) or with my phone on mobile data (different IP address).

Signout happens pretty fast after activating the bridge.

thefirstofthe300 commented 2 years ago

I too am hit by this particular behavior. I'm running my bridge on a VPS in DigitalOcean. Is everyone else using a public VPS provider?

Cerothen commented 2 years ago

I run it in an LXC container locally on my proxmox server

hooger commented 2 years ago

I have my own server in a server house. No VPS provider

pashutk commented 2 years ago

Same problem here.

I've tried VPS on DO and EMS servers, got the same result. Sometimes the error occurs after bridge trying to "Updating contacts of" and I didn't sync contacts in the official app so maybe it could be somehow related to the problem

ndarilek commented 2 years ago

FWIW, I also have contact-syncing disabled in the app and experience this issue. Not sure if it's at all relevant, but if this works for some folks but not for others then I wonder what the common thread might be.

martinetd commented 2 years ago

Same thing here, getting kicked after half a day or so.

Contact-syncing also disabled. It might be worth having someone try if that makes a difference at some point, I can delete all my contacts on the phone I'm using, add a couple of dummy ones and try sharing it to make it happy if that helps... I'll try next time I get kicked out (so probably around tomorrow)

martinetd commented 2 years ago

hmm, I actually got disconnected immediately when reconnecting mautrix-telegram this time. I relogged in on phone, shared a single contact they already had and logged in again from matrix and it didn't kick me out yet -- will post again if/when I notice the next force logoff...

martinetd commented 2 years ago

... and just got kicked out again, so unrelated. (sorry for the spam)

dsonck92 commented 2 years ago

Meanwhile I have recently tried to add my alt telegram again, and this time it still works to this day (added perhaps about 2 weeks ago). So it seems like after some regular use through the official apps, I have prevented the issue.

th0mcat commented 2 years ago

This is definitely happening to me as well, it happened so often that Telegram banned my phone number. I sent an email to get it unbanned (which worked), then I re-added my account, deleted everything from my mautrix-telegram database, and this is still happening. Going to try to not sign into the bridge for 2-3 weeks and see if that helps

th0mcat commented 2 years ago

I'm pretty sure something on the Telegram end is logging some people out if it doesn't like the app you are using to login.

I'd like to confirm that manually setting your device_info in your mautrix-telegram config.yaml to the following works for other people and not just me.

    device_info:                                                                           
        # "auto" = OS name+version.                                                        
        device_model: GooglePixel 6                                                
        # "auto" = Telethon version.
        system_version: SDK 32                                                    
        # "auto" = mautrix-telegram version.                                               
        app_version: 8.7.4 (26367)                                                         
        lang_code: en                                                                      
        system_lang_code: en
thefirstofthe300 commented 2 years ago

Setting the device info manually does seem to have helped with my issue. I haven't been booted yet. 🤞

pashutk commented 2 years ago

I can confirm that solution provided by @th0mcat is working for me too, at least for some time. I'll update the message if it works only temporarily/unstable. Thanks!

ndarilek commented 2 years ago

I can confirm that this worked for me as well, though I'm now having a different issue. If like me you use the Matrix Docker Ansible playbooks, here is how I set these device properties.

boxmein commented 2 years ago

I can confirm we had this issue but only with a new user who recently joined our server. At this time existing logins were not dropped because of the device_info being "suspicious".

This was disruptive af because it was completely un-indicated by both Telegram Desktop messages/notifications and Matrix messages

https://github.com/mautrix/telegram/issues/733#issuecomment-1175267044 fixed the issue for our server, for the time being.

tquest1 commented 1 year ago

I have tried adding the device info to my vars.yml - I am using the ansible-docker install - but I'm still getting logged out of all my sessions after about 5 mins. Can anyone tell me if have added it correctly - this is the telegram part of my vars.yaml:


matrix_mautrix_telegram_enabled: true
matrix_mautrix_telegram_api_id: redacted
matrix_mautrix_telegram_api_hash: redacted
matrix_mautrix_telegram_configuration_extension_yaml: |
  bridge:
    permissions:
      '@redacted:redacted': admin
    encryption:
      allow: true
      default: true
    device_info:
      device_model: GooglePixel 6
      system_version: SDK 32
      app_version: 8.7.4 (26367)
      lang_code: en
      system_lang_code: en
matrix_mautrix_telegram_login_shared_secret: redacted
BatteredBunny commented 1 year ago

I have tried adding the device info to my vars.yml - I am using the ansible-docker install - but I'm still getting logged out of all my sessions after about 5 mins. Can anyone tell me if have added it correctly - this is the telegram part of my vars.yaml:

matrix_mautrix_telegram_enabled: true
matrix_mautrix_telegram_api_id: redacted
matrix_mautrix_telegram_api_hash: redacted
matrix_mautrix_telegram_configuration_extension_yaml: |
  bridge:
    permissions:
      '@redacted:redacted': admin
    encryption:
      allow: true
      default: true
    device_info:
      device_model: GooglePixel 6
      system_version: SDK 32
      app_version: 8.7.4 (26367)
      lang_code: en
      system_lang_code: en
matrix_mautrix_telegram_login_shared_secret: redacted

I got it working with this config, i think yours might just be wrong

matrix_mautrix_telegram_configuration_extension_yaml: |
  bridge:
    permissions:
      '@redacted:redacted': admin
  telegram:
    device_info:
      device_model: GooglePixel 6
      system_version: SDK 32
      app_version: 8.7.4 (26367)
      lang_code: en
      system_lang_code: en
hooger commented 1 year ago

'@redacted:redacted': admin

Is it the matrix user you are bridging telegram to? Or some arbitrary "telegram admin" account?

steadfasterX commented 1 day ago

thx @th0mcat !

what I did after logging in with my second account (brand new phone number):

not sure which of these both fixed it or both together but at least it does not kick me out immediately anymore. before that I was kicked directly after doing sync chats.

also to note: