supabaseUrl is required
The console says supabaseUrl is required? createClient got an empty URL. Set the project URL the code reads, then rebuild.
Reviewed October 16, 2026
What it means in plain English
The Supabase client refused to start. supabase-js throws supabaseUrl is required. when the URL string is empty or only spaces. A URL that is not http:// or https:// throws Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL. instead.
Supabase's JavaScript reference says both supabaseUrl and supabaseKey are required. The URL is the one supplied when you create the project. The client does not invent it.
Likely causes
- The variable the code reads is missing in the environment that built the site, so it is
undefined. - The code reads
import.meta.env.VITE_SUPABASE_URL(Vite) orprocess.env.NEXT_PUBLIC_SUPABASE_URL(Next.js), and the host saved a different name. - Vite folded the value in at build time. Adding it later, without a new build, leaves the live bundle empty.
- The string in the host is not the project URL. It has to be an
https://URL, not the project id by itself.
How to fix it, step by step
- Find the
createClientcall. Note the exact variable names. Do not rename them in the host to something the code does not read. - Copy the project URL from the Supabase project dashboard. The initializing reference says that URL is supplied when you create the project. It looks like
https://your-project-id.supabase.co. - For a Lovable Cloud project hosted somewhere else, Lovable's guide says to set
VITE_SUPABASE_URLandVITE_SUPABASE_PUBLISHABLE_KEYbefore the build. Copy those names from the project's.envif the code uses them. - Put the same names on the host, for the Production environment, then redeploy. On Vite, a name without the
VITE_prefix stays off the browser bundle. See Vite env var missing the VITE_ prefix. - Use the publishable key as
supabaseKeyin browser code. Do not put a secret key in aVITE_orNEXT_PUBLIC_variable.
How to check it worked
- Reload the live site. The console no longer says
supabaseUrl is required. - A request from the page goes to
https://your-project-id.supabase.co, not to an empty host.
Sources
- https://supabase.com/docs/reference/javascript/initializing (opens in a new tab)
- https://github.com/supabase/supabase-js/blob/21e9d4b7/packages/core/supabase-js/src/lib/helpers.ts (opens in a new tab)
- https://docs.lovable.dev/tips-tricks/external-deployment-hosting (opens in a new tab)
- https://vite.dev/guide/env-and-mode (opens in a new tab)
- https://nextjs.org/docs/app/guides/environment-variables (opens in a new tab)
Related fixes
More Supabase keys and config fixes
More Environment variables fixes
Keep going on your own.
The guides stay free. A deep leak report is $15. Fix packs are $24, or $49 for all three. There is no done-for-you repair.