{"id":1735,"library":"supabase-functions","title":"Supabase Functions Python Client","description":"The `supabase-functions` Python library provides a client to interact with Supabase Edge Functions. It allows Python applications to invoke serverless functions deployed on Supabase's global edge network, handling invocation details and response parsing. Current version is 2.28.3, and it typically sees updates aligned with the broader Supabase ecosystem and bug fixes.","status":"active","version":"2.28.3","language":"en","source_language":"en","source_url":"https://github.com/supabase-community/supabase-functions-py","tags":["supabase","functions","serverless","edge functions","client"],"install":[{"cmd":"pip install supabase-functions","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Underlying Supabase client for shared functionality like auth handling.","package":"supabase-py","optional":false}],"imports":[{"symbol":"SupabaseFunctionsClient","correct":"from supabase_functions import SupabaseFunctionsClient"}],"quickstart":{"code":"import os\nfrom supabase_functions import SupabaseFunctionsClient\n\nsupabase_url = os.environ.get('SUPABASE_URL', 'YOUR_SUPABASE_URL')\nsupabase_key = os.environ.get('SUPABASE_KEY', 'YOUR_SUPABASE_KEY')\n\nif supabase_url == 'YOUR_SUPABASE_URL' or supabase_key == 'YOUR_SUPABASE_KEY':\n    print(\"Warning: Please set SUPABASE_URL and SUPABASE_KEY environment variables or replace placeholders.\")\n    exit()\n\nclient = SupabaseFunctionsClient(supabase_url, supabase_key)\n\ntry:\n    # Invoke a function named 'my-function' with a JSON body\n    response = client.invoke(\n        \"my-function\",\n        invoke_options={\n            \"body\": {\"name\": \"World\"},\n            \"headers\": {\"Content-Type\": \"application/json\"}\n        }\n    )\n    print(\"Function invoked successfully:\")\n    print(response.json())\nexcept Exception as e:\n    print(f\"Error invoking function: {e}\")\n    # Example of a common error if function does not exist or network issue\n    if \"Name or service not known\" in str(e):\n        print(\"Hint: Check your SUPABASE_URL and network connectivity.\")\n    elif \"404 Client Error\" in str(e):\n        print(\"Hint: Ensure 'my-function' is deployed and the name is correct.\")","lang":"python","description":"Initializes the SupabaseFunctionsClient and demonstrates how to invoke a deployed Edge Function with a JSON payload. Requires `SUPABASE_URL` and `SUPABASE_KEY` environment variables."},"warnings":[{"fix":"Ensure `SUPABASE_URL` and `SUPABASE_KEY` are correctly set and correspond to your Supabase project. For client-side invocation, the `anon` key is typically used; for server-side, a service role key might be required.","message":"Incorrect `supabase_url` or `supabase_key`. Misconfiguration often leads to `AuthApiError`, `HTTPError` (e.g., 401 Unauthorized), or `ConnectionError` when invoking functions.","severity":"gotcha","affected_versions":"All"},{"fix":"Pass a dictionary to `invoke_options` with keys like `body`, `headers`, or `query_params`. For example: `client.invoke(\"my-function\", invoke_options={\"body\": {\"data\": \"value\"}, \"headers\": {\"Content-Type\": \"application/json\"}})`.","message":"Improper use of `invoke_options`. The function body and other HTTP options (like `headers` or `query_params`) must be passed as a dictionary under the `invoke_options` argument, not directly as separate arguments to the `invoke` method.","severity":"gotcha","affected_versions":"All"},{"fix":"Verify the function name exactly matches the deployed function's name. Check your Supabase dashboard to confirm the function's deployment status and ensure any necessary CORS configurations are in place if invoking from a browser.","message":"Ensure the Edge Function is deployed and accessible. Failures might occur if the function name is misspelled, it's not deployed to the target region, or there are network access restrictions/CORS issues.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-04-09T00:00:00.000Z","next_check":"2026-07-08T00:00:00.000Z"}