You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When attempting to subscribe to real-time changes on the trade_tokens table using Supabase's Python client, the connection fails with a timeout error. The error indicates that the on_join_push_timeout callback is incorrectly defined, causing a TypeError. This issue persists across different environments and servers, even with the latest version of Supabase installed and a clean Python environment.
To Reproduce
Steps to reproduce the behavior, including code snippets:
Setup Supabase Client:
import asyncio
import logging
from supabase._async.client import AsyncClient as Client, create_client
from supabase.lib.client_options import ClientOptions
# Enable basic logging
logging.basicConfig(level=logging.INFO)
# Supabase connection details
supabase_url = "https://dmwfqahwcgkglvwyzhiy.supabase.co"
supabase_key = "YOUR_SUPABASE_KEY"
async def create_supabase() -> Client:
return await create_client(supabase_url, supabase_key)
Define Change Handler and Test Function:
def handle_changes(payload):
logging.info(f"Change received: {payload}")
async def test_realtime():
client = await create_supabase()
logging.info("Connecting to Supabase realtime...")
# Connect to Supabase real-time
await client.realtime.connect()
# Create channel and subscribe to changes
channel = client.realtime.channel('trade-tokens-updates')
await channel.on_postgres_changes(
'INSERT',
schema='public',
table='trade_tokens',
callback=handle_changes
).subscribe()
# Keep the connection open
try:
logging.info("Listening for changes...")
await asyncio.sleep(300) # Keep running for 5 minutes
except Exception as e:
logging.error(f"An unexpected error occurred: {e}")
finally:
logging.info("Disconnecting...")
await client.close()
if __name__ == "__main__":
asyncio.run(test_realtime())
Observe the Error:
INFO:root:Connecting to Supabase realtime...
INFO:realtime._async.client:Connection was successful
INFO:root:send: {"topic": "realtime:trade-tokens-updates", "event": "phx_join", ...}
INFO:root:Listening for changes...
ERROR:root:join push timeout for channel realtime:trade-tokens-updates
...
TypeError: AsyncRealtimeChannel.subscribe.<locals>.on_join_push_timeout() takes 0 positional arguments but 1 was given
Expected behavior
The Supabase client should successfully subscribe to real-time changes on the trade_tokens table and invoke the handle_changes callback whenever a new INSERT event occurs. The connection should remain stable without timing out, allowing continuous listening for database changes.
System information
System Information
OS: Linux (Ubuntu 22.04)
Python Version: 3.11
Supabase Version: 2.7.4
Supabase Python Client: supabase-py
Additional context
The issue occurs despite having the latest Supabase version (2.7.4) installed.
A clean Python environment was used to rule out dependency conflicts.
The problem persists across different servers and local machines.
The error suggests that the on_join_push_timeout callback is incorrectly defined to accept no arguments, whereas it is invoked with one argument (payload).
Potential mismatch between callback signature and expected parameters in the realtime package.
INFO:root:Connecting to Supabase realtime...
INFO:realtime._async.client:Connection was successful
INFO:root:send: {"topic": "realtime:trade-tokens-updates", "event": "phx_join", "payload": {"config": {"broadcast": {"ack": false, "self": false}, "presence": {"key": ""}, "private": false, "postgres_changes": [{"event": "INSERT", "schema": "public", "table": "trade_tokens"}]}, "access_token": "X"}, "ref": "1", "join_ref": "1"}
INFO:root:Listening for changes...
ERROR:root:join push timeout for channel realtime:trade-tokens-updates
/home/ramon/test/test_env/lib/python3.11/site-packages/realtime/_async/channel.py:88: RuntimeWarning: coroutine 'AsyncTimer.schedule_timeout' was never awaited
self.rejoin_timer.schedule_timeout()
Object allocated at (most recent call last):
File "/home/ramon/test/test_env/lib/python3.11/site-packages/realtime/_async/channel.py", lineno 88
self.rejoin_timer.schedule_timeout()
ERROR:asyncio:Task exception was never retrieved
future: <Task finished name='Task-5' coro=<AsyncPush.start_timeout.<locals>.timeout() done, defined at /home/ramon/test/test_env/lib/python3.11/site-packages/realtime/_async/push.py:83> exception=TypeError('AsyncRealtimeChannel.subscribe.<locals>.on_join_push_timeout() takes 0 positional arguments but 1 was given')>
Traceback (most recent call last):
File "/home/ramon/test/test_env/lib/python3.11/site-packages/realtime/_async/push.py", line 85, in timeout
self.trigger("timeout", {})
File "/home/ramon/test/test_env/lib/python3.11/site-packages/realtime/_async/push.py", line 95, in trigger
self.channel._trigger(self.ref_event, payload)
File "/home/ramon/test/test_env/lib/python3.11/site-packages/realtime/_async/channel.py", line 524, in _trigger
binding.callback(payload, ref)
File "/home/ramon/test/test_env/lib/python3.11/site-packages/realtime/_async/push.py", line 79, in on_reply
self._match_receive(**self.received_resp)
File "/home/ramon/test/test_env/lib/python3.11/site-packages/realtime/_async/push.py", line 117, in _match_receive
hook.callback(response)
TypeError: AsyncRealtimeChannel.subscribe.<locals>.on_join_push_timeout() takes 0 positional arguments but 1 was given
SOURCE CODE
import asyncio
import logging
from supabase._async.client import AsyncClient as Client, create_client
from supabase.lib.client_options import ClientOptions
# Enable basic logging
logging.basicConfig(level=logging.INFO)
# Supabase connection details
supabase_url = "https://dmwfqahwcgkglvwyzhiy.supabase.co"
supabase_key = "X"
async def create_supabase() -> Client:
return await create_client(supabase_url, supabase_key)
def handle_changes(payload):
logging.info(f"Change received: {payload}")
async def test_realtime():
client = await create_supabase()
logging.info("Connecting to Supabase realtime...")
# Connect to Supabase real-time
await client.realtime.connect()
# Create channel and subscribe to changes
channel = client.realtime.channel('trade-tokens-updates')
await channel.on_postgres_changes(
'INSERT',
schema='public',
table='trade_tokens',
callback=handle_changes
).subscribe()
# Keep the connection open
try:
logging.info("Listening for changes...")
await asyncio.sleep(300) # Keep running for 5 minutes
except Exception as e:
logging.error(f"An unexpected error occurred: {e}")
finally:
logging.info("Disconnecting...")
await client.close()
if __name__ == "__main__":
asyncio.run(test_realtime())
Verification of Real-time Enablement
Verified that real-time is enabled on the trade_tokens table by executing the following SQL command:
SELECT * FROM pg_publication_tables WHERE pubname = 'supabase_realtime';
Bug report
Describe the bug
When attempting to subscribe to real-time changes on the trade_tokens table using Supabase's Python client, the connection fails with a timeout error. The error indicates that the on_join_push_timeout callback is incorrectly defined, causing a TypeError. This issue persists across different environments and servers, even with the latest version of Supabase installed and a clean Python environment.
To Reproduce
Steps to reproduce the behavior, including code snippets:
Setup Supabase Client:
Observe the Error:
Expected behavior
The Supabase client should successfully subscribe to real-time changes on the trade_tokens table and invoke the handle_changes callback whenever a new INSERT event occurs. The connection should remain stable without timing out, allowing continuous listening for database changes.
System information
System Information
OS: Linux (Ubuntu 22.04)
Python Version: 3.11
Supabase Version: 2.7.4
Supabase Python Client: supabase-py
Additional context
The issue occurs despite having the latest Supabase version (2.7.4) installed.
A clean Python environment was used to rule out dependency conflicts.
The problem persists across different servers and local machines.
The error suggests that the on_join_push_timeout callback is incorrectly defined to accept no arguments, whereas it is invoked with one argument (payload).
Potential mismatch between callback signature and expected parameters in the realtime package.
SOURCE CODE
Verification of Real-time Enablement
Verified that real-time is enabled on the trade_tokens table by executing the following SQL command:
SELECT * FROM pg_publication_tables WHERE pubname = 'supabase_realtime';
Result:
[ { "pubname": "supabase_realtime", "schemaname": "public", "tablename": "trade_tokens", "attnames": "{id,quote_token_mint,wallet_public_key,amount_base_token_to_spend,take_profit_value,stop_loss_value,slippage_bps,status,buy_transaction_signature,sell_transaction_signature,error_message,created_at,updated_at,amount_base_token_received,amount_quote_token_received,amount_quote_token_sold,price_per_quote_token_buy,price_per_quote_token_sell,exit_reason,pnl_value,roi_percentage,buy_price_impact_percentage,amount_base_token_spent,base_token_mint,sell_price_impact_percentage,buy_transaction_at,sell_transaction_at,amount_quote_token_to_sell,source}", "rowfilter": null } ]
The text was updated successfully, but these errors were encountered: