i changed server location from america to asia and did in shell kill 1 and on that bot it started. I’ve tried starting other bots and they don’t go immediately after killing 1. Do I have to rewrite them from scratch?
No, you dont have to reqrite anything
Didnt really understand this part. You mean it worked for 1 repl but not others? Weird
Changing the server and killing the section worked but again after somewhere around the ball park off less than an hour it again had problems connecting to Pyrogram and after deleting the bot session and kill 1 again the bot started working and this is not a permanent fix and a occurring issue .
so now we are at a point where changing the server to Asia or changing them back doesn’t work and the problem connecting to Pyrogram remains please inform this problem to the admins .
exactly worked on that repl for a while after it gave the same error again. It continues to be a problem to this day
@ShaneAtReplit it’s been a week where we have difficulties connecting to Pyrogram library and about three days where it’s not even possible to connect to Pyrogram library even with the given solutions and I think this a problem from your end and a few people are experiencing it here in this topic and other topics like : Telegram client unable to be used on replit - #3 by HuwHillman
please fix this issue.
Thank you for flagging. I will look into this and let you know as soon as I have an update!
Is it possible to get a minimum viable reproduction of the issue? Once you have that, could you send the link to the Repl so we can test it on our end?
Yes of course but if it’s ok I’m gonna message it to you directly because im not comfortable sharing my app id and api hash .
I too have the same issue
The Repl you send me is your entire Telegram bot. Would you mind creating a Repl from scratch and configuring Pyrogtam as you have it so we can test this with the smallest amount of code for easy inspection?
To elaborate, it isn’t easy for us to debug an issue that is for a larger project. However, if we have a minimum viable repro (the smallest amount of code that reproduces the issue), it makes it heaps easier for us to debug.
Sorry for the misunderstanding I messaged you the new repl that you asked for
I’ve been having the same problem for more than a week and I haven’t been able to fix it in any way. I’m pretty sure my code is error free. Please let me know when you find a solution
If you go into your account page, is your server location set to Asia or North America?
Also, to all who are seeing this issue, we are willing to grant some cycles to test their bot in a Deployment. Please message me directly and I will send over the cycles
I also encountered this problem. could you please send me the cycles
We have identified the issue. To combat abuse, we require all HTTP traffic to have either an SNI (Server Name Identification) or a Hostname header. Pyrogram connects to raw IP addresses without specifying an SNI or a Hostname header.
The issue here is that Pyrogram will need to update its codebase to support this, or users who intend to run Telegram bots on Replit will need to use a library other than Pyrogram (that is until they fix the issue) if they intend to host their Repl without using Deployments.
We have confirmed that using a Deployment does not encounter the issue as we do not require the same headers for those. If you Deploy your Repl (https://replit.com/deployments), you should be able to host your Telegram bots using Pyrogram without issues.
Not only Pyrogram but also Telethon started encountering a similar issue when i run it never ask me for phone number , just get stuck, is it the same issue?
If it deals with Telegram, then yes, we believe any library that has recently started failing to connect to Telegram is caused by this issue. As we said above, the issue needs to be fixed by the developer of the library.
Pyrogram or Telethon, the usual full Telegram MTproto clients by default use tcp, unlike the botApi server libraries that connect to api.telegram.org who just wrap the calls to http server with MTproto backend (tdlib) those two are the MTproto backends.
Pyrogram or Telethon connect through sockets with just ip and port, so, is there a way to set “SNI” like server_hostname or anything like that through a socket connection? they both use asyncio.open_connection internally, can’t Replit exclude some of the legit ip addresses, including the ones related to Telegram from this anti-abuse for the main 5 MTproto servers, sorry for not knowing much about SNI part, but i want to modify the library to make it work but can’t wrap my head around it mixing the two.
The list of IPs pyrogram connects are 5 main datacenters (and other sub file download or cdn datacenters, but ignorable), they’re assigned to users depending on the phone number region once user signs up and all the bots they create will need to connect to their owner dc, ips are hardcoded in the data_center.py, they’re taken from internal methods of MTproto api offers (GetConfig), they’re official datacenter ips of Telegram.
However, from what i see MTproto servers also support http but less reliable or used protocol by default, Telethon has basic http transport implemtation, is that the way to go? to ditch the tcp in Replit and switch to http for pyrogram, haven’t tested the http part