Error fixes / Supabase

Supabase

Supabase: supabaseUrl is required

The Supabase client was created without a project URL.

The error

supabaseUrl is required.

What it means

The official client throws supabaseUrl is required when the URL argument is empty, and Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL when the value is not an http(s) URL. On a deployed app this almost always means the environment variable was missing at build time. Local .env files are not copied to Vercel, Netlify or Cloudflare for you.

Fix

  1. Find the createClient call and the variable it reads, often NEXT_PUBLIC_SUPABASE_URL or VITE_SUPABASE_URL.
  2. Set that variable on the host for the environment you are deploying. Include https:// and the project ref.
  3. Redeploy. Client bundles only see the value from the build you just ran.
  4. If the URL exists but the error says it must be HTTP or HTTPS, remove quotes or a mailto-style typo.
  5. Pair it with the anon key from the same project, or the next error will be Invalid API key.

Prompt

Fix prompt
Paste into Cursor or Claude Code
The app throws "supabaseUrl is required." or "Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL."

Find createClient and make it read the project URL and anon key from environment variables. Fail with a message that names the missing variable and does not print values. Do not hard-code a real project URL. List the variable names I must set in production, and say whether they are public (browser) or server-only. The URL and anon key are public. The service role key is not.

Questions

Why did the build succeed with an empty URL?

The client is often created when a page loads, not when the project compiles. The deployment can be green and still crash in the browser.

Should the Supabase URL be a secret?

No. The project URL and anon key are public. The service role key is the secret, and it should not use a public env prefix.

I set the variable and I still see the error. What next?

Redeploy after saving the variable. Also check you edited the production environment, not only preview, and that the variable name matches the code exactly.

Related fixes

Source: Supabase docs: API keys. Updated 14 October 2026.