Inconsistent Environment Variable Naming Between Supabase Connect Panel And Flask Quickstart Documentation
The Supabase Connect panel generates .env templates using SUPABASE_KEY, while the Flask quickstart documentation and supabase-py client expect SUPABASE_PUBLISHABLE_KEY. This mismatch causes authentication failures (supabase_key is required) for users following the Connect panel instructions.
A naming inconsistency in user-facing configuration templates: the Connect panel has not been updated to align with the canonical environment variable name SUPABASE_PUBLISHABLE_KEY adopted by Supabase client libraries and documentation.
1. Follow Flask quickstart steps until environment variable creation. 2. Click 'Open Connect panel' and copy the generated .env snippet containing SUPABASE_KEY. 3. Use that .env file. 4. Run app.py which reads SUPABASE_PUBLISHABLE_KEY via supabase-py. 5. Observe SupabaseException: supabase_key is required because the value is None.
Fixing Code Block
# Temporary compatibility fix in user's Flask app (app.py)
import os
from supabase import create_client, Client
url = os.environ.get("SUPABASE_URL")
key = os.environ.get("SUPABASE_PUBLISHABLE_KEY") or os.environ.get("SUPABASE_KEY")
if not url or not key:
raise ValueError("SUPABASE_URL and SUPABASE_PUBLISHABLE_KEY (or SUPABASE_KEY) must be set")
supabase: Client = create_client(url, key)
# The permanent fix should be applied on the Supabase dashboard Connect panel:
# Change the generated .env snippet to use SUPABASE_PUBLISHABLE_KEY instead of SUPABASE_KEY.
The temporary code change provides backward compatibility by accepting either environment variable, preventing immediate breakage. The permanent fix requires updating the Connect panel template to output SUPABASE_PUBLISHABLE_KEY, aligning with the documentation and supabase-py defaults.
Edge Case Audit
If only the client code is patched to support both keys, users may continue using the deprecated SUPABASE_KEY in new projects, perpetuating the inconsistency. If the Connect panel is updated without updating existing users' .env files, they will encounter the same error until they rename the variable. Rolling back the code compatibility shim after enough time will require a deprecation notice. Ensure all official quickstarts (Flask, Django, etc.) are updated simultaneously to avoid further fragmentation.