supabase / supabase-py

Python Client for Supabase. Query Postgres from Flask, Django, FastAPI. Python user authentication, security policies, edge functions, file storage, and realtime data streaming. Good first issue.
https://supabase.com/docs/reference/python
MIT License
1.74k stars 205 forks source link

ERROR:root:join push timeout for channel realtime #946

Open blockfer-rp opened 1 month ago

blockfer-rp commented 1 month ago

Bug report

Describe the bug

The Supabase real-time client is experiencing frequent disconnections and reconnection attempts. The client fails to maintain a stable connection, with repeated join push timeouts and keepalive ping timeouts.

To Reproduce

Steps to reproduce the behavior:

  1. Set up a Supabase project with real-time enabled
  2. Create a Python script using the following code:
import asyncio
import logging
from supabase._async.client import AsyncClient as Client, create_client

logging.basicConfig(level=logging.DEBUG)

supabase_url = "https://dmwfqahwcgkglvwyzhiy.supabase.co"
supabase_key = "your_supabase_key_here"

def handle_changes(payload):
    logging.info(f"Change received: {payload}")

async def test_realtime():
    supabase: Client = await create_client(supabase_url, supabase_key)

    try:
        await supabase.realtime.connect()
        logging.info("Connected to Supabase realtime")

        channel = supabase.channel('trade-tokens-updates')
        channel = channel.on_postgres_changes(
            event="INSERT",
            schema="public",
            table="trade_tokens",
            callback=handle_changes
        )

        await channel.subscribe()
        logging.info("Subscribed to channel")

        await asyncio.sleep(300)  # Wait for 5 minutes
    except Exception as e:
        logging.error(f"An error occurred: {e}")
    finally:
        if 'channel' in locals() and channel:
            await channel.unsubscribe()
        await supabase.realtime.disconnect()

if __name__ == "__main__":
    asyncio.run(test_realtime())

Expected behavior

The client should maintain a stable connection to the Supabase real-time service, successfully subscribing to the channel and staying connected without frequent timeouts or disconnections.

System information

supabase: 2.8.0 realtime: 2.0.5

Sanidhyafeaturist commented 3 weeks ago

I will see what should be done

visheshdvivedi commented 3 weeks ago

This issue might be related to the 'realtime' package and not 'supabase-py' package. In that case, we need to close this issue and add one issue there.

image
jackyliang commented 9 hours ago

I am getting this error too, also using realtime