gramjs: Sending photo does not work

Hello, latest library version, the following code (also tried sendFile). Does not work. Sending regular text message is ok. It tries to upload, because I see 0 in log, it’s progress from onProgress.

  const toUpload = new CustomFile(
     "up.jpg",
     fs.statSync(filepath).size,
     filepath
  );

  const uploaded = await client.uploadFile({
     file: toUpload,
     onProgress: (progress) => console.log(progress),
  });

  const result = await client.invoke(
     new Api.messages.SendMedia({
        peer: "maxfrai",
        media: new Api.InputMediaUploadedPhoto({
           file: uploaded,
        }),
        message: "Hello there!",
        randomId: BigInt("-4151817774164"),
     })
  );

[2021-07-17T10:52:30.236Z] [DEBUG] - [Running gramJS version 1.7.15] [2021-07-17T10:52:30.243Z] [INFO] - [Connecting to 149.154.167.51:80/TCPFull…] [2021-07-17T10:52:30.243Z] [DEBUG] - [Connecting] [2021-07-17T10:52:30.278Z] [DEBUG] - [Finished connecting] [2021-07-17T10:52:30.279Z] [DEBUG] - [Connection success!] [2021-07-17T10:52:30.279Z] [DEBUG] - [Already have an auth key …] [2021-07-17T10:52:30.279Z] [DEBUG] - [Starting receive loop] [2021-07-17T10:52:30.280Z] [DEBUG] - [Receiving items from the network…] [2021-07-17T10:52:30.280Z] [DEBUG] - [Starting send loop] [2021-07-17T10:52:30.280Z] [DEBUG] - [Waiting for messages to send…false] [2021-07-17T10:52:30.280Z] [INFO] - [Connection to 149.154.167.51:80/TCPFull complete!] [2021-07-17T10:52:30.295Z] [DEBUG] - [Assigned msgId = 6985846556743718040 to InvokeWithLayer] [2021-07-17T10:52:30.295Z] [DEBUG] - [Encrypting 1 message(s) in 72 bytes for sending] [2021-07-17T10:52:30.299Z] [DEBUG] - [Encrypted messages put in a queue to be sent] [2021-07-17T10:52:30.299Z] [DEBUG] - [Waiting for messages to send…false] [2021-07-17T10:52:30.345Z] [DEBUG] - [Handling bad salt for message 6985846556743718040] [2021-07-17T10:52:30.345Z] [DEBUG] - [1 message(s) will be resent] [2021-07-17T10:52:30.345Z] [DEBUG] - [Receiving items from the network…] [2021-07-17T10:52:30.345Z] [DEBUG] - [Assigned msgId = 6985846556947718512 to InvokeWithLayer] [2021-07-17T10:52:30.345Z] [DEBUG] - [Encrypting 1 message(s) in 72 bytes for sending] [2021-07-17T10:52:30.347Z] [DEBUG] - [Encrypted messages put in a queue to be sent] [2021-07-17T10:52:30.348Z] [DEBUG] - [Waiting for messages to send…false] [2021-07-17T10:52:30.348Z] [DEBUG] - [Assigned msgId = 6985846556959718596 to MsgsAck] [2021-07-17T10:52:30.348Z] [DEBUG] - [Encrypting 1 message(s) in 36 bytes for sending] [2021-07-17T10:52:30.349Z] [DEBUG] - [Encrypted messages put in a queue to be sent] [2021-07-17T10:52:30.350Z] [DEBUG] - [Waiting for messages to send…false] [2021-07-17T10:52:30.395Z] [DEBUG] - [Handling container] [2021-07-17T10:52:30.395Z] [DEBUG] - [Handling new session created] [2021-07-17T10:52:30.395Z] [DEBUG] - [Handling acknowledge for 6985846556947718512] [2021-07-17T10:52:30.395Z] [DEBUG] - [Receiving items from the network…] [2021-07-17T10:52:30.523Z] [DEBUG] - [Handling RPC result for message 6985846556947718512] [2021-07-17T10:52:30.525Z] [DEBUG] - [Receiving items from the network…] [2021-07-17T10:52:30.526Z] [DEBUG] - [Assigned msgId = 6985846557671718488 to updates.GetState] [2021-07-17T10:52:30.526Z] [DEBUG] - [Encrypting 1 message(s) in 20 bytes for sending] [2021-07-17T10:52:30.527Z] [DEBUG] - [Encrypted messages put in a queue to be sent] [2021-07-17T10:52:30.527Z] [DEBUG] - [Waiting for messages to send…false] [2021-07-17T10:52:30.528Z] [DEBUG] - [Assigned msgId = 6985846557675718200 to MsgsAck] [2021-07-17T10:52:30.529Z] [DEBUG] - [Encrypting 1 message(s) in 60 bytes for sending] [2021-07-17T10:52:30.529Z] [DEBUG] - [Encrypted messages put in a queue to be sent] [2021-07-17T10:52:30.530Z] [DEBUG] - [Waiting for messages to send…false] [2021-07-17T10:52:30.657Z] [DEBUG] - [Handling RPC result for message 6985846557671718488] [2021-07-17T10:52:30.658Z] [DEBUG] - [Receiving items from the network…] [2021-07-17T10:52:30.671Z] [DEBUG] - [Borrowing client for DC 1] [2021-07-17T10:52:30.672Z] [DEBUG] - [Getting DC 1] [2021-07-17T10:52:30.672Z] [DEBUG] - [Assigned msgId = 6985846558255718124 to help.GetConfig] [2021-07-17T10:52:30.672Z] [DEBUG] - [Encrypting 1 message(s) in 20 bytes for sending] [2021-07-17T10:52:30.673Z] [DEBUG] - [Encrypted messages put in a queue to be sent] [2021-07-17T10:52:30.673Z] [DEBUG] - [Waiting for messages to send…false] [2021-07-17T10:52:30.673Z] [DEBUG] - [Assigned msgId = 6985846558259718788 to MsgsAck] [2021-07-17T10:52:30.673Z] [DEBUG] - [Encrypting 1 message(s) in 36 bytes for sending] [2021-07-17T10:52:30.674Z] [DEBUG] - [Encrypted messages put in a queue to be sent] [2021-07-17T10:52:30.674Z] [DEBUG] - [Waiting for messages to send…false] [2021-07-17T10:52:30.796Z] [DEBUG] - [Handling RPC result for message 6985846558255718124] [2021-07-17T10:52:30.796Z] [DEBUG] - [Receiving items from the network…] [2021-07-17T10:52:30.797Z] [INFO] - [Connecting to 149.154.175.55:443/TCPFull…] [2021-07-17T10:52:30.797Z] [DEBUG] - [Connecting] [2021-07-17T10:52:30.834Z] [DEBUG] - [Finished connecting] [2021-07-17T10:52:30.834Z] [DEBUG] - [Connection success!] [2021-07-17T10:52:30.834Z] [DEBUG] - [Already have an auth key …] [2021-07-17T10:52:30.834Z] [DEBUG] - [Starting receive loop] [2021-07-17T10:52:30.834Z] [DEBUG] - [Receiving items from the network…] [2021-07-17T10:52:30.834Z] [DEBUG] - [Starting send loop] [2021-07-17T10:52:30.834Z] [DEBUG] - [Waiting for messages to send…false] [2021-07-17T10:52:30.834Z] [INFO] - [Connection to 149.154.175.55:443/TCPFull complete!] 0 [2021-07-17T10:52:30.836Z] [DEBUG] - [Assigned msgId = 6985846558907718552 to upload.SaveFilePart] [2021-07-17T10:52:30.836Z] [DEBUG] - [Encrypting 1 message(s) in 131108 bytes for sending] [2021-07-17T10:52:30.866Z] [DEBUG] - [Encrypted messages put in a queue to be sent] [2021-07-17T10:52:30.866Z] [DEBUG] - [Waiting for messages to send…false] [2021-07-17T10:52:31.701Z] [INFO] - [Broken authorization key; resetting] [2021-07-17T10:52:37.691Z] [DEBUG] - [Handling update UpdateShort] [2021-07-17T10:52:37.691Z] [DEBUG] - [Receiving items from the network…] [2021-07-17T10:52:41.307Z] [DEBUG] - [Handling update UpdateShort] [2021-07-17T10:52:41.308Z] [DEBUG] - [Receiving items from the network…]

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 19 (8 by maintainers)

Most upvoted comments

Did you remove the session string ? needs a clean session

i’ll roll out a fix in 5 min to npm