[Python] FastAPI /send route hangs indefinitely when calling Supabase .execute() — no...

Discussão em 'Python' iniciado por Stack, Maio 17, 2025.

  1. Stack

    Stack Membro Participativo

    I'm building a UPI-like money transfer system using FastAPI and Supabase in Python.

    My /send route is supposed to:

    Fetch sender and receiver from the users table

    Update both of their balances

    Log the transaction in a transactions table

    ✅ Setup Backend: FastAPI

    Supabase: Python client (supabase-py)

    All .execute() calls are synchronous

    Using create_client(url, service_role_key)

    but now in supabase-client.py import supabase cannot be resolved i think that might be the error

    Problem When I hit the /send route from the frontend, it just hangs forever — status remains pending and I get no error in the browser or backend logs.

    Even opening http://localhost:8000/send shows the request stuck in loading state.

    ⚠️ What I’ve tried: Added print() statements before and after each Supabase .execute() call — it hangs before the first call completes

    Verified Supabase project URL and service role key are correct

    FastAPI routes like /, /balance/{upi_id} work fine if I comment out .execute() calls

    Tested Supabase queries directly in the dashboard — they work

    CORS is configured correctly

    Here's a minimal version of the hanging code: python @app.post("/send") def send_money(request: SendMoneyRequest): print("Handling /send request")

    sender_response = supabase.table("users").select("*").eq("upi_id", request.payer_id).single().execute()
    sender = sender_response.data # ❌ Hangs here and never continues


    ⚠️ What I’ve tried: Added print() statements before and after each Supabase .execute() call — it hangs before the first call completes

    Verified Supabase project URL and service role key are correct

    FastAPI routes like /, /balance/{upi_id} work fine if I comment out .execute() calls

    Tested Supabase queries directly in the dashboard — they work

    CORS is configured correctly

    Continue reading...

Compartilhe esta Página