Open Aamir-K11 opened 1 week ago
having similar issue, the only thing that differs that I initialize it a bit differently
const session = new StringSession(account.session)
const tgClient = new TelegramClient(session, account.api_id, account.api_hash, {
connectionRetries: 5,
floodSleepThreshold: 0,
useWSS: true,
testServers: false,
})
tgClient.setLogLevel(LogLevel.DEBUG)
await tgClient.connect()
and got this:
[2024-07-03T23:58:53.010] [INFO] - [Started reconnecting]
[2024-07-03T23:58:53.011] [DEBUG] - [Closing current connection...]
[2024-07-03T23:58:53.011] [WARN] - [[Reconnect] Closing current connection...]
[2024-07-03T23:58:53.011] [INFO] - [Disconnecting from venus.web.telegram.org:443/TCPFull...]
[2024-07-03T23:58:53.011] [DEBUG] - [Closing current connection...]
[2024-07-03T23:58:53.011] [INFO] - [Connecting to venus.web.telegram.org:443/TCPFull...]
[2024-07-03T23:58:53.011] [DEBUG] - [Connecting]
[2024-07-03T23:58:53.012] [DEBUG] - [Got undefined message(s) to send]
[2024-07-03T23:58:53.012] [DEBUG] - [Reconnecting]
[2024-07-03T23:58:53.050] [DEBUG] - [Finished connecting]
[2024-07-03T23:58:53.051] [DEBUG] - [Connection success!]
[2024-07-03T23:58:53.051] [DEBUG] - [Already have an auth key ...]
[2024-07-03T23:58:53.051] [DEBUG] - [Starting send loop]
[2024-07-03T23:58:53.051] [DEBUG] - [Waiting for messages to send... false]
[2024-07-03T23:58:53.051] [DEBUG] - [Starting receive loop]
[2024-07-03T23:58:53.051] [DEBUG] - [Receiving items from the network...]
[2024-07-03T23:58:53.051] [INFO] - [Connection to venus.web.telegram.org:443/TCPFull complete!]
[2024-07-03T23:58:53.051] [INFO] - [Handling reconnect!]
[2024-07-03T23:58:53.051] [DEBUG] - [Assigned msgId = 7387532440122215640 to InvokeWithLayer]
[2024-07-03T23:58:53.051] [DEBUG] - [Got 1 message(s) to send]
[2024-07-03T23:58:53.051] [DEBUG] - [Encrypting 1 message(s) in 72 bytes for sending]
[2024-07-03T23:58:53.051] [DEBUG] - [Sending InvokeWithLayer]
[2024-07-03T23:58:53.052] [DEBUG] - [Encrypted messages put in a queue to be sent]
[2024-07-03T23:58:53.052] [DEBUG] - [Waiting for messages to send... false]
[2024-07-03T23:58:53.092] [INFO] - [connection closed]
[2024-07-03T23:58:53.092] [WARN] - [Connection closed while receiving data]
Error: Not connected
at ConnectionTCPFull.recv (.../node_modules/telegram/network/connection/Connection.js:71:15)
at MTProtoSender._recvLoop (.../node_modules/telegram/network/MTProtoSender.js:365:24)
I've been trying to connect to telegram using TelegramClient in a worker thread. The worker hangs up at
await client.connect
and after retries throws connection error. Strange that it works locally but is a problem with Docker.The application has been dockerized. Here is the docker-compose.yml.
DockerFile
Finally, caddyfile for reverse proxy
Any ideas?
Some observations:
I have checked Docker network and the containers are all connected and I could ping redis and caddy from within the telegram.
Changing to
connectionRetries: -1
yields the result false on connect instead of hanging up. So, it doesn't connect and timeout.