gram-js / gramjs

NodeJS/Browser MTProto API Telegram client library,
MIT License
1.28k stars 179 forks source link

Error when get media file: Cannot read property 'send' of null #96

Closed santiagz closed 3 years ago

santiagz commented 3 years ago

discussed this issue in another problem. #69 but at the moment getting the file works for me only on one account out of 10. the same error on all accs. the code is absolutely correct, but I think there is a problem with the accounts, or is it something else?

source:

const { TelegramClient } = require('telegram')
const { StringSession } = require('telegram/sessions')
const input = require('input') // npm i input
const fs = require('fs')

const apiId = 11111
const apiHash = 'aaaaa'
const stringSession = new StringSession(''); 

(async () => {
    const client = new TelegramClient(stringSession, apiId, apiHash, {
        appVersion:"2.7.1",
        deviceModel:"PC",
        systemVersion:"Windows 10"
      })

      await client.start({
        phoneNumber: async () => await input.text('number ?'),
        password: async () => await input.text('password?'),
        phoneCode: async () => await input.text('Code ?'),
        onError: (err) => console.log(err),
    });

    const result = await client.getMessages('me', {
        limit: 1,
    });

    try{
        const media = result[0].media;
        if (media) {
            const buffer = await client.downloadMedia(media, {
                workers: 1,
            });
            console.log("result is", buffer);
        }
    }catch (e) {
        console.log(e)
    }
})()

here is the log:

LOG
[log.file.txt](https://github.com/gram-js/gramjs/files/6630221/log.file.txt) ``` PS C:\Users\User\Desktop\tgtest\tgtest> node .\CONNECT.js [2021-06-10T09:45:34.674Z] [INFO] - [Connecting to 149.154.167.51:80/TCPFull...] [2021-06-10T09:45:34.676Z] [DEBUG] - [Connecting] [2021-06-10T09:45:34.752Z] [DEBUG] - [Finished connecting] [2021-06-10T09:45:34.754Z] [DEBUG] - [Connection success!] [2021-06-10T09:45:34.754Z] [DEBUG] - [New auth_key attempt ...] [2021-06-10T09:45:34.835Z] [DEBUG] - [Starting authKey generation step 1] [2021-06-10T09:45:34.835Z] [DEBUG] - [Finished authKey generation step 1] [2021-06-10T09:45:34.835Z] [DEBUG] - [Starting authKey generation step 2] [2021-06-10T09:45:35.055Z] [DEBUG] - [Finished authKey generation step 2] [2021-06-10T09:45:35.055Z] [DEBUG] - [Starting authKey generation step 3] [2021-06-10T09:45:35.474Z] [DEBUG] - [Finished authKey generation step 3] [2021-06-10T09:45:35.475Z] [DEBUG] - [Generated new auth_key successfully] [2021-06-10T09:45:35.475Z] [DEBUG] - [Starting receive loop] [2021-06-10T09:45:35.476Z] [DEBUG] - [Receiving items from the network...] [2021-06-10T09:45:35.476Z] [DEBUG] - [Starting send loop] [2021-06-10T09:45:35.477Z] [DEBUG] - [Waiting for messages to send...false] [2021-06-10T09:45:35.478Z] [INFO] - [Connection to 149.154.167.51:80/TCPFull complete!] [2021-06-10T09:45:35.479Z] [DEBUG] - [Assigned msgId = 6972099166033139820 to InvokeWithLayer] [2021-06-10T09:45:35.479Z] [DEBUG] - [Encrypting 1 message(s) in 76 bytes for sending] [2021-06-10T09:45:35.481Z] [DEBUG] - [Encrypted messages put in a queue to be sent] [2021-06-10T09:45:35.481Z] [DEBUG] - [Waiting for messages to send...false] [2021-06-10T09:45:35.557Z] [DEBUG] - [Handling bad salt for message 6972099166033139820] [2021-06-10T09:45:35.557Z] [DEBUG] - [1 message(s) will be resent] [2021-06-10T09:45:35.559Z] [DEBUG] - [Receiving items from the network...] [2021-06-10T09:45:35.559Z] [DEBUG] - [Assigned msgId = 6972099166345139140 to InvokeWithLayer] [2021-06-10T09:45:35.559Z] [DEBUG] - [Encrypting 1 message(s) in 76 bytes for sending] [2021-06-10T09:45:35.559Z] [DEBUG] - [Encrypted messages put in a queue to be sent] [2021-06-10T09:45:35.560Z] [DEBUG] - [Waiting for messages to send...false] [2021-06-10T09:45:35.560Z] [DEBUG] - [Assigned msgId = 6972099166357139224 to MsgsAck] [2021-06-10T09:45:35.560Z] [DEBUG] - [Encrypting 1 message(s) in 36 bytes for sending] [2021-06-10T09:45:35.561Z] [DEBUG] - [Encrypted messages put in a queue to be sent] [2021-06-10T09:45:35.563Z] [DEBUG] - [Waiting for messages to send...false] [2021-06-10T09:45:35.637Z] [DEBUG] - [Handling container] [2021-06-10T09:45:35.638Z] [DEBUG] - [Handling new session created] [2021-06-10T09:45:35.639Z] [DEBUG] - [Handling acknowledge for 6972099166345139140] [2021-06-10T09:45:35.639Z] [DEBUG] - [Receiving items from the network...] [2021-06-10T09:45:35.652Z] [DEBUG] - [Handling RPC result for message 6972099166345139140] [2021-06-10T09:45:35.655Z] [DEBUG] - [Receiving items from the network...] [2021-06-10T09:45:35.656Z] [DEBUG] - [Assigned msgId = 6972099166741139048 to updates.GetState] [2021-06-10T09:45:35.656Z] [DEBUG] - [Encrypting 1 message(s) in 20 bytes for sending] [2021-06-10T09:45:35.657Z] [DEBUG] - [Encrypted messages put in a queue to be sent] [2021-06-10T09:45:35.658Z] [DEBUG] - [Waiting for messages to send...false] [2021-06-10T09:45:35.659Z] [DEBUG] - [Assigned msgId = 6972099166753139132 to MsgsAck] [2021-06-10T09:45:35.659Z] [DEBUG] - [Encrypting 1 message(s) in 60 bytes for sending] [2021-06-10T09:45:35.660Z] [DEBUG] - [Encrypted messages put in a queue to be sent] [2021-06-10T09:45:35.660Z] [DEBUG] - [Waiting for messages to send...false] [2021-06-10T09:45:35.824Z] [DEBUG] - [Handling RPC result for message 6972099166741139048] [2021-06-10T09:45:35.826Z] [DEBUG] - [Receiving items from the network...] [2021-06-10T09:45:35.826Z] [DEBUG] - [Assigned msgId = 6972099167421139356 to MsgsAck] ? number ? [2021-06-10T09:45:35.839Z] [DEBUG] - [Encrypting 1 message(s) in 36 bytes for sending] [2021-06-10T09:45:35.841Z] [DEBUG] - [Encrypted messages put in a queue to be sent] [2021-06-10T09:45:35.841Z] [DEBUG] - [Waiting for messages to send...false] [2021-06-10T09:45:35.842Z] [DEBUG] - [Assigned msgId = 6972099167485139484 to MsgsAck] [2021-06-10T09:45:35.842Z] [DEBUG] - [Encrypting 1 message(s) in 36 bytes for sending] [2021-06-10T09:45:35.843Z] [DEBUG] - [Encrypted messages put in a queue to be sent] [2021-06-10T09:45:35.844Z] [DEBUG] - [Waiting for messages to send...false] ? number ? +7 904 669 75 19 [2021-06-10T09:45:39.956Z] [DEBUG] - [Assigned msgId = 6972099185121008996 to auth.SendCode] [2021-06-10T09:45:39.957Z] [DEBUG] - [Encrypting 1 message(s) in 88 bytes for sending] [2021-06-10T09:45:39.958Z] [DEBUG] - [Encrypted messages put in a queue to be sent] [2021-06-10T09:45:39.958Z] [DEBUG] - [Waiting for messages to send...false] [2021-06-10T09:45:40.150Z] [DEBUG] - [Handling RPC result for message 6972099185121008996] [2021-06-10T09:45:40.151Z] [DEBUG] - [Receiving items from the network...] ? Code ? 52945 [2021-06-10T09:45:44.330Z] [DEBUG] - [Assigned msgId = 6972099204087845104 to auth.SignIn] [2021-06-10T09:45:44.330Z] [DEBUG] - [Encrypting 1 message(s) in 68 bytes for sending] [2021-06-10T09:45:44.331Z] [DEBUG] - [Encrypted messages put in a queue to be sent] [2021-06-10T09:45:44.332Z] [DEBUG] - [Waiting for messages to send...false] [2021-06-10T09:45:44.333Z] [DEBUG] - [Assigned msgId = 6972099204099845188 to MsgsAck] [2021-06-10T09:45:44.333Z] [DEBUG] - [Encrypting 1 message(s) in 36 bytes for sending] [2021-06-10T09:45:44.336Z] [DEBUG] - [Encrypted messages put in a queue to be sent] [2021-06-10T09:45:44.336Z] [DEBUG] - [Waiting for messages to send...false] [2021-06-10T09:45:44.429Z] [DEBUG] - [Handling RPC result for message 6972099204087845104] [2021-06-10T09:45:44.431Z] [DEBUG] - [Receiving items from the network...] [2021-06-10T09:45:44.431Z] [DEBUG] - [Assigned msgId = 6972099204491845384 to MsgsAck] [2021-06-10T09:45:44.432Z] [DEBUG] - [Encrypting 1 message(s) in 36 bytes for sending] [2021-06-10T09:45:44.432Z] [DEBUG] - [Encrypted messages put in a queue to be sent] [2021-06-10T09:45:44.433Z] [DEBUG] - [Waiting for messages to send...false] [2021-06-10T09:45:44.433Z] [DEBUG] - [Assigned msgId = 6972099204503845468 to account.GetPassword] [2021-06-10T09:45:44.434Z] [DEBUG] - [Assigned msgId = 6972099204507845180 to MsgsAck] [2021-06-10T09:45:44.434Z] [DEBUG] - [Encrypting 2 message(s) in 80 bytes for sending] [2021-06-10T09:45:44.435Z] [DEBUG] - [Encrypted messages put in a queue to be sent] [2021-06-10T09:45:44.436Z] [DEBUG] - [Waiting for messages to send...false] [2021-06-10T09:45:44.719Z] [DEBUG] - [Handling RPC result for message 6972099204503845468] ? password? [2021-06-10T09:45:44.721Z] [DEBUG] - [Receiving items from the network...] ? password? qwerty333221 [2021-06-10T09:45:49.652Z] [DEBUG] - [Assigned msgId = 6972099226854681400 to auth.CheckPassword] [2021-06-10T09:45:49.653Z] [DEBUG] - [Encrypting 1 message(s) in 328 bytes for sending] [2021-06-10T09:45:49.654Z] [DEBUG] - [Encrypted messages put in a queue to be sent] [2021-06-10T09:45:49.654Z] [DEBUG] - [Waiting for messages to send...false] [2021-06-10T09:45:49.655Z] [DEBUG] - [Assigned msgId = 6972099226862681772 to MsgsAck] [2021-06-10T09:45:49.655Z] [DEBUG] - [Encrypting 1 message(s) in 36 bytes for sending] [2021-06-10T09:45:49.655Z] [DEBUG] - [Encrypted messages put in a queue to be sent] [2021-06-10T09:45:49.656Z] [DEBUG] - [Waiting for messages to send...false] [2021-06-10T09:45:49.835Z] [DEBUG] - [Handling RPC result for message 6972099226854681400] [2021-06-10T09:45:49.837Z] [DEBUG] - [Receiving items from the network...] [2021-06-10T09:45:49.837Z] [INFO] - [Signed in successfully as 2] [2021-06-10T09:45:49.840Z] [DEBUG] - [Assigned msgId = 6972099227606681256 to messages.Search] [2021-06-10T09:45:49.840Z] [DEBUG] - [Encrypting 1 message(s) in 68 bytes for sending] [2021-06-10T09:45:49.843Z] [DEBUG] - [Encrypted messages put in a queue to be sent] [2021-06-10T09:45:49.843Z] [DEBUG] - [Waiting for messages to send...false] [2021-06-10T09:45:49.844Z] [DEBUG] - [Assigned msgId = 6972099227622682004 to MsgsAck] [2021-06-10T09:45:49.844Z] [DEBUG] - [Encrypting 1 message(s) in 36 bytes for sending] [2021-06-10T09:45:49.845Z] [DEBUG] - [Encrypted messages put in a queue to be sent] [2021-06-10T09:45:49.845Z] [DEBUG] - [Waiting for messages to send...false] [2021-06-10T09:45:49.941Z] [DEBUG] - [Handling RPC result for message 6972099227606681256] [2021-06-10T09:45:49.945Z] [DEBUG] - [Receiving items from the network...] [2021-06-10T09:45:49.947Z] [DEBUG] - [Assigned msgId = 6972099228034681704 to help.GetConfig] [2021-06-10T09:45:49.947Z] [DEBUG] - [Encrypting 1 message(s) in 20 bytes for sending] [2021-06-10T09:45:49.949Z] [DEBUG] - [Encrypted messages put in a queue to be sent] [2021-06-10T09:45:49.950Z] [DEBUG] - [Waiting for messages to send...false] [2021-06-10T09:45:49.950Z] [DEBUG] - [Assigned msgId = 6972099228046681788 to MsgsAck] [2021-06-10T09:45:49.951Z] [DEBUG] - [Encrypting 1 message(s) in 36 bytes for sending] [2021-06-10T09:45:49.952Z] [DEBUG] - [Encrypted messages put in a queue to be sent] [2021-06-10T09:45:49.953Z] [DEBUG] - [Waiting for messages to send...false] [2021-06-10T09:45:50.148Z] [DEBUG] - [Handling RPC result for message 6972099228034681704] [2021-06-10T09:45:50.150Z] [DEBUG] - [Receiving items from the network...] [2021-06-10T09:45:50.150Z] [INFO] - [Connecting to 149.154.167.51:443/TCPFull...] [2021-06-10T09:45:50.151Z] [DEBUG] - [Connecting] [2021-06-10T09:45:50.216Z] [DEBUG] - [Finished connecting] [2021-06-10T09:45:50.217Z] [DEBUG] - [Connection success!] [2021-06-10T09:45:50.218Z] [DEBUG] - [New auth_key attempt ...] [2021-06-10T09:45:50.291Z] [DEBUG] - [Starting authKey generation step 1] [2021-06-10T09:45:50.292Z] [DEBUG] - [Finished authKey generation step 1] [2021-06-10T09:45:50.292Z] [DEBUG] - [Starting authKey generation step 2] [2021-06-10T09:45:50.549Z] [DEBUG] - [Finished authKey generation step 2] [2021-06-10T09:45:50.549Z] [DEBUG] - [Starting authKey generation step 3] [2021-06-10T09:45:50.943Z] [DEBUG] - [Finished authKey generation step 3] [2021-06-10T09:45:50.944Z] [DEBUG] - [Generated new auth_key successfully] [2021-06-10T09:45:50.944Z] [DEBUG] - [Starting receive loop] [2021-06-10T09:45:50.945Z] [DEBUG] - [Receiving items from the network...] [2021-06-10T09:45:50.945Z] [DEBUG] - [Starting send loop] [2021-06-10T09:45:50.945Z] [DEBUG] - [Waiting for messages to send...false] [2021-06-10T09:45:50.945Z] [INFO] - [Connection to 149.154.167.51:443/TCPFull complete!] [2021-06-10T09:45:50.945Z] [INFO] - [Exporting authorization for data center 149.154.167.51] [2021-06-10T09:45:50.946Z] [DEBUG] - [Assigned msgId = 6972099232325649292 to auth.ExportAuthorization] [2021-06-10T09:45:50.946Z] [DEBUG] - [Encrypting 1 message(s) in 24 bytes for sending] [2021-06-10T09:45:50.947Z] [DEBUG] - [Encrypted messages put in a queue to be sent] [2021-06-10T09:45:50.947Z] [DEBUG] - [Waiting for messages to send...false] [2021-06-10T09:45:50.948Z] [DEBUG] - [Assigned msgId = 6972099232333648712 to MsgsAck] [2021-06-10T09:45:50.948Z] [DEBUG] - [Encrypting 1 message(s) in 36 bytes for sending] [2021-06-10T09:45:50.949Z] [DEBUG] - [Encrypted messages put in a queue to be sent] [2021-06-10T09:45:50.949Z] [DEBUG] - [Waiting for messages to send...false] [2021-06-10T09:45:51.034Z] [DEBUG] - [Handling RPC result for message 6972099232325649292] [2021-06-10T09:45:51.035Z] [INFO] - [Disconnecting from 149.154.167.51:443/TCPFull...] [2021-06-10T09:45:51.036Z] [DEBUG] - [Closing current connection...] [2021-06-10T09:45:51.036Z] [DEBUG] - [Receiving items from the network...] [2021-06-10T09:45:51.037Z] [DEBUG] - [Assigned msgId = 6972099232976616532 to MsgsAck] [2021-06-10T09:45:51.037Z] [DEBUG] - [Encrypting 1 message(s) in 36 bytes for sending] [2021-06-10T09:45:51.038Z] [WARN] - [Connection closed while receiving data] [2021-06-10T09:45:51.039Z] [INFO] - [Connecting to 149.154.167.51:443/TCPFull...] [2021-06-10T09:45:51.039Z] [DEBUG] - [Connecting] [2021-06-10T09:45:51.039Z] [DEBUG] - [Encrypted messages put in a queue to be sent] [2021-06-10T09:45:51.040Z] [DEBUG] - [Waiting for messages to send...false] [2021-06-10T09:45:51.040Z] [DEBUG] - [Assigned msgId = 6972099232996616036 to MsgsAck] [2021-06-10T09:45:51.040Z] [DEBUG] - [Encrypting 1 message(s) in 36 bytes for sending] [2021-06-10T09:45:51.041Z] [DEBUG] - [Encrypted messages put in a queue to be sent] [2021-06-10T09:45:51.041Z] [DEBUG] - [Waiting for messages to send...false] [2021-06-10T09:45:51.042Z] [INFO] - [connection closed] [2021-06-10T09:45:51.115Z] [DEBUG] - [Finished connecting] [2021-06-10T09:45:51.115Z] [DEBUG] - [Connection success!] [2021-06-10T09:45:51.116Z] [DEBUG] - [Already have an auth key ...] [2021-06-10T09:45:51.116Z] [DEBUG] - [Starting receive loop] [2021-06-10T09:45:51.116Z] [DEBUG] - [Receiving items from the network...] [2021-06-10T09:45:51.117Z] [DEBUG] - [Starting send loop] [2021-06-10T09:45:51.117Z] [DEBUG] - [Waiting for messages to send...false] [2021-06-10T09:45:51.117Z] [INFO] - [Connection to 149.154.167.51:443/TCPFull complete!] [2021-06-10T09:45:51.118Z] [INFO] - [Exporting authorization for data center 149.154.167.51] [2021-06-10T09:45:51.118Z] [DEBUG] - [Assigned msgId = 6972099233308616312 to auth.ExportAuthorization] [2021-06-10T09:45:51.118Z] [DEBUG] - [Encrypting 1 message(s) in 24 bytes for sending] [2021-06-10T09:45:51.119Z] [DEBUG] - [Encrypted messages put in a queue to be sent] [2021-06-10T09:45:51.119Z] [DEBUG] - [Waiting for messages to send...false] [2021-06-10T09:45:51.349Z] [DEBUG] - [Handling RPC result for message 6972099233308616312] [2021-06-10T09:45:51.350Z] [INFO] - [Disconnecting from 149.154.167.51:443/TCPFull...] [2021-06-10T09:45:51.350Z] [DEBUG] - [Closing current connection...] [2021-06-10T09:45:51.351Z] [DEBUG] - [Receiving items from the network...] [2021-06-10T09:45:51.351Z] [DEBUG] - [Assigned msgId = 6972099234236615808 to MsgsAck] [2021-06-10T09:45:51.351Z] [DEBUG] - [Encrypting 1 message(s) in 36 bytes for sending] [2021-06-10T09:45:51.352Z] [WARN] - [Connection closed while receiving data] [2021-06-10T09:45:51.352Z] [INFO] - [Connecting to 149.154.167.51:443/TCPFull...] [2021-06-10T09:45:51.352Z] [DEBUG] - [Connecting] [2021-06-10T09:45:51.353Z] [DEBUG] - [Encrypted messages put in a queue to be sent] [2021-06-10T09:45:51.353Z] [DEBUG] - [Waiting for messages to send...false] [2021-06-10T09:45:51.354Z] [DEBUG] - [Assigned msgId = 6972099234248615892 to MsgsAck] [2021-06-10T09:45:51.354Z] [DEBUG] - [Encrypting 1 message(s) in 36 bytes for sending] [2021-06-10T09:45:51.354Z] [DEBUG] - [Encrypted messages put in a queue to be sent] [2021-06-10T09:45:51.355Z] [DEBUG] - [Waiting for messages to send...false] [2021-06-10T09:45:51.355Z] [INFO] - [connection closed] [2021-06-10T09:45:51.428Z] [DEBUG] - [Finished connecting] [2021-06-10T09:45:51.428Z] [DEBUG] - [Connection success!] [2021-06-10T09:45:51.429Z] [DEBUG] - [Already have an auth key ...] [2021-06-10T09:45:51.429Z] [DEBUG] - [Starting receive loop] [2021-06-10T09:45:51.429Z] [DEBUG] - [Receiving items from the network...] [2021-06-10T09:45:51.431Z] [DEBUG] - [Starting send loop] [2021-06-10T09:45:51.431Z] [DEBUG] - [Waiting for messages to send...false] [2021-06-10T09:45:51.431Z] [INFO] - [Connection to 149.154.167.51:443/TCPFull complete!] [2021-06-10T09:45:51.432Z] [INFO] - [Exporting authorization for data center 149.154.167.51] [2021-06-10T09:45:51.432Z] [DEBUG] - [Assigned msgId = 6972099234564615876 to auth.ExportAuthorization] [2021-06-10T09:45:51.432Z] [DEBUG] - [Encrypting 1 message(s) in 24 bytes for sending] [2021-06-10T09:45:51.433Z] [DEBUG] - [Encrypted messages put in a queue to be sent] [2021-06-10T09:45:51.434Z] [DEBUG] - [Waiting for messages to send...false] [2021-06-10T09:45:51.798Z] [DEBUG] - [Handling RPC result for message 6972099234564615876] [2021-06-10T09:45:51.799Z] [INFO] - [Disconnecting from 149.154.167.51:443/TCPFull...] [2021-06-10T09:45:51.799Z] [DEBUG] - [Closing current connection...] [2021-06-10T09:45:51.800Z] [DEBUG] - [Receiving items from the network...] [2021-06-10T09:45:51.800Z] [DEBUG] - [Assigned msgId = 6972099236032616288 to MsgsAck] [2021-06-10T09:45:51.800Z] [DEBUG] - [Encrypting 1 message(s) in 36 bytes for sending] [2021-06-10T09:45:51.801Z] [WARN] - [Connection closed while receiving data] [2021-06-10T09:45:51.801Z] [INFO] - [Connecting to 149.154.167.51:443/TCPFull...] [2021-06-10T09:45:51.802Z] [DEBUG] - [Connecting] [2021-06-10T09:45:51.802Z] [DEBUG] - [Encrypted messages put in a queue to be sent] [2021-06-10T09:45:51.802Z] [DEBUG] - [Waiting for messages to send...false] [2021-06-10T09:45:51.803Z] [DEBUG] - [Assigned msgId = 6972099236048616084 to MsgsAck] [2021-06-10T09:45:51.804Z] [DEBUG] - [Encrypting 1 message(s) in 36 bytes for sending] [2021-06-10T09:45:51.805Z] [DEBUG] - [Encrypted messages put in a queue to be sent] [2021-06-10T09:45:51.805Z] [DEBUG] - [Waiting for messages to send...false] [2021-06-10T09:45:51.805Z] [INFO] - [connection closed] [2021-06-10T09:45:51.869Z] [DEBUG] - [Finished connecting] [2021-06-10T09:45:51.870Z] [DEBUG] - [Connection success!] [2021-06-10T09:45:51.870Z] [DEBUG] - [Already have an auth key ...] [2021-06-10T09:45:51.870Z] [DEBUG] - [Starting receive loop] [2021-06-10T09:45:51.870Z] [DEBUG] - [Receiving items from the network...] [2021-06-10T09:45:51.871Z] [DEBUG] - [Starting send loop] [2021-06-10T09:45:51.871Z] [DEBUG] - [Waiting for messages to send...false] [2021-06-10T09:45:51.871Z] [INFO] - [Connection to 149.154.167.51:443/TCPFull complete!] [2021-06-10T09:45:51.872Z] [INFO] - [Exporting authorization for data center 149.154.167.51] [2021-06-10T09:45:51.872Z] [DEBUG] - [Assigned msgId = 6972099236324616108 to auth.ExportAuthorization] [2021-06-10T09:45:51.872Z] [DEBUG] - [Encrypting 1 message(s) in 24 bytes for sending] [2021-06-10T09:45:51.873Z] [DEBUG] - [Encrypted messages put in a queue to be sent] [2021-06-10T09:45:51.873Z] [DEBUG] - [Waiting for messages to send...false] [2021-06-10T09:45:52.109Z] [DEBUG] - [Handling RPC result for message 6972099236324616108] [2021-06-10T09:45:52.110Z] [INFO] - [Disconnecting from 149.154.167.51:443/TCPFull...] [2021-06-10T09:45:52.110Z] [DEBUG] - [Closing current connection...] [2021-06-10T09:45:52.110Z] [DEBUG] - [Receiving items from the network...] [2021-06-10T09:45:52.110Z] [DEBUG] - [Assigned msgId = 6972099237571583068 to MsgsAck] [2021-06-10T09:45:52.111Z] [DEBUG] - [Encrypting 1 message(s) in 36 bytes for sending] [2021-06-10T09:45:52.113Z] [WARN] - [Connection closed while receiving data] [2021-06-10T09:45:52.113Z] [INFO] - [Connecting to 149.154.167.51:443/TCPFull...] [2021-06-10T09:45:52.113Z] [DEBUG] - [Connecting] [2021-06-10T09:45:52.114Z] [DEBUG] - [Encrypted messages put in a queue to be sent] [2021-06-10T09:45:52.114Z] [DEBUG] - [Waiting for messages to send...false] [2021-06-10T09:45:52.115Z] [DEBUG] - [Assigned msgId = 6972099237591583524 to MsgsAck] [2021-06-10T09:45:52.115Z] [DEBUG] - [Encrypting 1 message(s) in 36 bytes for sending] [2021-06-10T09:45:52.115Z] [DEBUG] - [Encrypted messages put in a queue to be sent] [2021-06-10T09:45:52.116Z] [DEBUG] - [Waiting for messages to send...false] [2021-06-10T09:45:52.116Z] [INFO] - [connection closed] [2021-06-10T09:45:52.179Z] [DEBUG] - [Finished connecting] [2021-06-10T09:45:52.179Z] [DEBUG] - [Connection success!] [2021-06-10T09:45:52.180Z] [DEBUG] - [Already have an auth key ...] [2021-06-10T09:45:52.180Z] [DEBUG] - [Starting receive loop] [2021-06-10T09:45:52.180Z] [DEBUG] - [Receiving items from the network...] [2021-06-10T09:45:52.181Z] [DEBUG] - [Starting send loop] [2021-06-10T09:45:52.181Z] [DEBUG] - [Waiting for messages to send...false] [2021-06-10T09:45:52.181Z] [INFO] - [Connection to 149.154.167.51:443/TCPFull complete!] [2021-06-10T09:45:52.181Z] [INFO] - [Exporting authorization for data center 149.154.167.51] [2021-06-10T09:45:52.182Z] [DEBUG] - [Assigned msgId = 6972099237859583172 to auth.ExportAuthorization] [2021-06-10T09:45:52.182Z] [DEBUG] - [Encrypting 1 message(s) in 24 bytes for sending] [2021-06-10T09:45:52.183Z] [DEBUG] - [Encrypted messages put in a queue to be sent] [2021-06-10T09:45:52.184Z] [DEBUG] - [Waiting for messages to send...false] [2021-06-10T09:45:52.354Z] [DEBUG] - [Handling RPC result for message 6972099237859583172] [2021-06-10T09:45:52.355Z] [INFO] - [Disconnecting from 149.154.167.51:443/TCPFull...] [2021-06-10T09:45:52.355Z] [DEBUG] - [Closing current connection...] [2021-06-10T09:45:52.355Z] [DEBUG] - [Receiving items from the network...] [2021-06-10T09:45:52.355Z] [DEBUG] - [Assigned msgId = 6972099238547583852 to MsgsAck] [2021-06-10T09:45:52.356Z] [DEBUG] - [Encrypting 1 message(s) in 36 bytes for sending] [2021-06-10T09:45:52.356Z] [WARN] - [Connection closed while receiving data] [2021-06-10T09:45:52.357Z] [INFO] - [Downloading file in chunks of 131072 bytes] [2021-06-10T09:45:52.358Z] [DEBUG] - [Encrypted messages put in a queue to be sent] [2021-06-10T09:45:52.358Z] [DEBUG] - [Waiting for messages to send...false] [2021-06-10T09:45:52.359Z] [DEBUG] - [Assigned msgId = 6972099238563583648 to MsgsAck] [2021-06-10T09:45:52.359Z] [DEBUG] - [Encrypting 1 message(s) in 36 bytes for sending] TypeError: Cannot read property 'send' of null at Object. (C:\Users\User\Desktop\tgtest\tgtest\node_modules\telegram\client\downloads.js:82:38) at Generator.next () at C:\Users\User\Desktop\tgtest\tgtest\node_modules\telegram\client\downloads.js:8:71 at new Promise () at __awaiter (C:\Users\User\Desktop\tgtest\tgtest\node_modules\telegram\client\downloads.js:4:12) at C:\Users\User\Desktop\tgtest\tgtest\node_modules\telegram\client\downloads.js:79:34 at Object. (C:\Users\User\Desktop\tgtest\tgtest\node_modules\telegram\client\downloads.js:109:16) at Generator.next () at fulfilled (C:\Users\User\Desktop\tgtest\tgtest\node_modules\telegram\client\downloads.js:5:58) at processTicksAndRejections (internal/process/task_queues.js:95:5) [2021-06-10T09:45:52.365Z] [DEBUG] - [Encrypted messages put in a queue to be sent] [2021-06-10T09:45:52.365Z] [DEBUG] - [Waiting for messages to send...false] [2021-06-10T09:45:52.365Z] [INFO] - [connection closed] ```
painor commented 3 years ago

what version of gramjs are you on ?

santiagz commented 3 years ago

6.14.13

painor commented 3 years ago

what. that's not a real one. the latest here should be 1.6.12 https://www.npmjs.com/package/telegram

santiagz commented 3 years ago

how that even possible?

PS C:\Users\User\Desktop\tgtest\tgtest> npm i telegram

> utf-8-validate@5.0.5 install C:\Users\User\Desktop\tgtest\tgtest\node_modules\utf-8-validate
> node-gyp-build

npm WARN tgtest No repository field.
npm WARN tgtest No license field.

+ telegram@1.6.12
added 6 packages from 1 contributor, updated 6 packages, moved 1 package and audited 78 packages in 8.524s

6 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

PS C:\Users\User\Desktop\tgtest\tgtest> npm -v telegram
6.14.13
painor commented 3 years ago

that's npm's version not gramjs one. anyway try with the new version it should give more info.

santiagz commented 3 years ago

that's npm's version not gramjs one. anyway try with the new version it should give more info.

yeah, thats helpd to get more info. the error took a different interpretation

new_log.txt

painor commented 3 years ago

hmm seems like it doesn't know what the current DC is. I'll do some tests and see if I can reproduce it.

santiagz commented 3 years ago

hmm seems like it doesn't know what the current DC is. I'll do some tests and see if I can reproduce it.

if u need i can give you credentials for one of my acc accounts that has this problem

painor commented 3 years ago

yes that would make it easier to debug. feel free to pm me the session string in private or email. (not the credentials)

painor commented 3 years ago

Thakn you so much for the session string it helped me fix this bug. This should be fixed in version 1.7.1. feel free to try it.

santiagz commented 3 years ago

thank you so much for your support!

santiagz commented 3 years ago

one more moment. I think your debug lines ( in my opinion like console.log) remain in the new version.

log.txt

painor commented 3 years ago

oh woops. forgot to remove it.