Network issue in Pyrogram - Replit

Problem description:
For the last few weeks, I’ve been getting Network issues while using pyrogram library in python. I’ve even tested this with my account with Pro plan, but the same result.

Expected behavior:
The code should just run fine without issues. As it works just fine in my computer or in other cloud hosting services.

Actual behavior:
Sometimes it gives KeyError: 0 which is a network issue as described in pyrogram discussion.
And sometimes it just keeps repeating
Network task started

Steps to reproduce:

from pyrogram import *
import logging, os

logger = logging.getLogger(__name__)
logging.basicConfig(
    format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
    level=logging.INFO)


api_id = 25650897
api_hash = "9a1ef2625e3afc3be978808117786ceb"
token = os.environ.get("TOKEN")
token = "5898931098:AAGrI-4q-9_OshOAolbAWnsYPJiQnnGrCU4"

app = Client("test", api_id=api_id, api_hash=api_hash, bot_token=token, in_memory=True)

@app.on_message(filters.text)
async def echo(_,m):
	await m.reply(m.text)

app.run()

Bug appears at this link:

https://replit.com/@iamthesadik/Pyro

Browser/OS/Device:
Replit Repo | Linux