question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: Cannot cast to any kind of peer

See original GitHub issue

Hello! After 2.0 update I have a problem with getting group id. My code dont have any changes before 2.0 update of this package.

When im trying to get group id, i have a error: “Cannot cast https://t.me/linkToAnyGroup to any kind of peer.”

Im using js, not ts.

Here is my code:

async function getGroupId() {
    const result = await client.invoke(
        new Api.channels.GetFullChannel({
            channel: tgLinkFromInput,
        })
    );
    let jsonResult = JSON.stringify(result, null, 2);
    let parsedResult = JSON.parse(jsonResult);
    return parsedResult['fullChat']['id'];
}

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:17 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
painorcommented, Dec 1, 2021

With the new updates telegram has made ids 64bit (bigInts in JS) and stopped older layers from working. GramJS now converts strings to IDs because they can’t be normal numbers anymore and that has broken link and phone resolving.

This will be fixed soon. For phones you will be required to add a “+” and for links it’ll work as it used to.

0reactions
sumboidcommented, Dec 1, 2021

@painor 2.0.5 seems to fix the issue, thanks a lot 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: Cannot cast NoneType to any kind of Peer ... - GitHub
When a user with 64-bit ID sends a message to Bot (updates for userbot work as expected), there is no peer in incoming...
Read more >
Telethon can't get chat entity anymore - Stack Overflow
As far as the error you got, get_entity returns coroutine so it must be awaited. >> TypeError: Cannot cast coroutine to any kind...
Read more >
TelegramClient — Telethon 1.26.1 documentation
When API calls fail in a way that causes Telethon to retry automatically, should the RPC error of the last attempt be raised...
Read more >
intToPtr - Documentation - The Zig Programming Language
undefined can be implicitly cast to any type. Once this happens, it is no longer possible to detect that the value is undefined...
Read more >
Users, Chats and Channels — Telethon 1.7.7 documentation
Sometimes, Telegram only needs to indicate the type of the entity along with their ID. For this purpose, Peer versions of the entities...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found