{"record":{"id":"312ade13e6046d98","repo":"BerriAI/litellm","slug":"litellm-error-trying-to-use-supabase-but-url-or-k","errorCode":null,"errorMessage":"LiteLLM Error, trying to use Supabase but url or key not passed. Create a table and set `litellm.supabase_url=<your-url>` and `litellm.supabase_key=<your-key>`","messagePattern":"LiteLLM Error, trying to use Supabase but url or key not passed\\. Create a table and set `litellm\\.supabase_url=<your-url>` and `litellm\\.supabase_key=<your-key>`","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/integrations/supabase.py","lineNumber":28,"sourceCode":"import litellm\n\n\nclass Supabase:\n    # Class variables or attributes\n    supabase_table_name = \"request_logs\"\n\n    def __init__(self):\n        # Instance variables\n        self.supabase_url = os.getenv(\"SUPABASE_URL\")\n        self.supabase_key = os.getenv(\"SUPABASE_KEY\")\n        try:\n            import supabase\n        except ImportError:\n            subprocess.check_call([sys.executable, \"-m\", \"pip\", \"install\", \"supabase\"])\n            import supabase\n\n        if self.supabase_url is None or self.supabase_key is None:\n            raise ValueError(\n                \"LiteLLM Error, trying to use Supabase but url or key not passed. Create a table and set `litellm.supabase_url=<your-url>` and `litellm.supabase_key=<your-key>`\"\n            )\n        self.supabase_client = supabase.create_client(self.supabase_url, self.supabase_key)\n\n    def input_log_event(self, model, messages, end_user, litellm_call_id, print_verbose):\n        try:\n            print_verbose(f\"Supabase Logging - Enters input logging function for model {model}\")\n            supabase_data_obj: Final = {\n                \"model\": model,\n                \"messages\": messages,\n                \"end_user\": end_user,\n                \"status\": \"initiated\",\n                \"litellm_call_id\": litellm_call_id,\n            }\n            data, count = self.supabase_client.table(self.supabase_table_name).insert(supabase_data_obj).execute()\n            print_verbose(f\"data: {data}\")\n        except Exception:\n            print_verbose(f\"Supabase Logging Error - {traceback.format_exc()}\")","sourceCodeStart":10,"sourceCodeEnd":46,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/integrations/supabase.py#L10-L46","documentation":"SupabaseLogger.__init__ reads SUPABASE_URL and SUPABASE_KEY from the environment and, if either is missing, raises ValueError telling you to configure them (the message references litellm.supabase_url but the code actually reads env vars). Note it also pip-installs supabase via subprocess on first use, so the import is not the failure mode here — the missing env vars are.","triggerScenarios":"Adding litellm.callbacks = [\"supabase\"] without exporting SUPABASE_URL/SUPABASE_KEY; setting litellm.supabase_url as a Python attribute (as the message hints) — which has no effect, since __init__ only reads os.environ; env vars defined in .env but the callback constructed before .env is loaded.","commonSituations":"Confusion between the documented litellm.supabase_url=... snippet and the env-var implementation; keys set in a different shell/container than the proxy process; project templates that omit the supabase env block.","solutions":["Export SUPABASE_URL and SUPABASE_KEY in the proxy's environment before constructing the callback","If you were following the message literally (litellm.supabase_url=...), switch to env vars — that is what the code reads","Verify inside the process: python -c \"import os; print(bool(os.getenv('SUPABASE_URL')), bool(os.getenv('SUPABASE_KEY')))\"","Also pip install supabase ahead of time to avoid the subprocess auto-install"],"exampleFix":"# before (has no effect)\nlitellm.supabase_url = \"https://xyz.supabase.co\"\nlitellm.supabase_key = \"eyJ...\"\nlitellm.callbacks = [\"supabase\"]  # ValueError\n\n# after\nimport os\nos.environ[\"SUPABASE_URL\"] = \"https://xyz.supabase.co\"\nos.environ[\"SUPABASE_KEY\"] = \"eyJ...\"\nlitellm.callbacks = [\"supabase\"]","handlingStrategy":"validation","validationCode":"import os\n\nmissing = [v for v in (\"SUPABASE_URL\", \"SUPABASE_KEY\") if not os.getenv(v)]\nif missing:\n    raise RuntimeError(f\"Supabase logging requires env vars: {missing}\")\nlitellm.callbacks = [\"supabase\"]","typeGuard":null,"tryCatchPattern":"try:\n    from litellm.integrations.supabase import SupabaseLogger\n    supabase_logger = SupabaseLogger()\nexcept ValueError as e:\n    if \"url or key not passed\" in str(e):\n        supabase_logger = None  # run without supabase logging\n    else:\n        raise","preventionTips":["Configure via SUPABASE_URL/SUPABASE_KEY env vars — the litellm.supabase_url attribute mentioned in the message is not what the code reads","Pre-install the supabase package to avoid its subprocess pip-install-on-import behavior in locked-down environments","Assert required env vars for every enabled callback at startup"],"tags":["supabase","configuration","environment","logging"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}