Short answer
Edge functions read keys from Secrets by exact name, such as STRIPE_SECRET_KEY. Check the secret exists with the name the function reads, add any secret you skipped when Lovable asked, and don’t put server keys in VITE_ variables, which go to the browser. If two Lovable projects share one Supabase project, they overwrite each other’s secrets.
Why the key is missing, and the fix
01
The secret was skipped or never added
“Anything that depends on the secret won't work until you add it.” Lovable, Secrets
When Lovable asked for the key, the prompt may have been skipped. Add it under More, Settings, Secrets, or ask Lovable in the chat to request it again. With your own Supabase project connected, secrets are managed in the Supabase dashboard instead. Names starting with SUPABASE_ or LOVABLE_ already exist, so don’t add those yourself.
02
The project was remixed
“Manually added secrets are not copied over, so re-enter them in the new project.” Lovable, Secrets
A remix gets fresh copies of the keys Lovable generates, but not the ones you added. Add those again in the new project.
03
The name doesn’t match
“The name is usually the exact environment variable your Edge Function will read.” Lovable, Secrets
The function reads one exact name. A secret saved as STRIPE_KEY won’t be found by code reading STRIPE_SECRET_KEY. Check the names in the Secrets list against the function code.
04
The key was put in a VITE_ variable
“Anything prefixed with VITE_ is a build-time, browser-exposed value and must live in your project's .env file instead, not in Secrets.” Lovable, Secrets
VITE_ variables are build-time values built into the page the browser downloads, so anyone can see them; they belong in .env, not in Secrets. Edge functions read server keys from Secrets. If a secret key was ever in a VITE_ variable, replace it at the service that issued it.
05
Two projects share one Supabase project
“Lovable projects that share one Supabase project overwrite each other's secrets, including LOVABLE_API_KEY, so any feature that uses that key stops working.” Lovable, Supabase integration
With your own Supabase project connected, Lovable projects that use the same one overwrite each other’s secrets. Give each its own Supabase project. If you share one on purpose, remember each project’s saves overwrite the other’s, including LOVABLE_API_KEY.
Checked against the vendor’s docs on : Lovable docs: Secrets; Lovable docs: Supabase integration (secrets).
Rather hand it over?
Fixed scope, fixed price, paid upfront. The work happens in writing; no call needed.
- from $450App Fix TicketOne reproducible bug in an existing mobile or web app, diagnosed and fixed.See scope and start
- from $450AI-Built App RescueA Lovable, Bolt or Cursor app checked end to end in 3 days, then its worst problems fixed at a fixed price.No issues worth fixing, no charge. If the Launch Check finds nothing rated medium or higher, Simon refunds the full $450. You keep the report either way.See scope and start
Related: Supabase service_role key exposed · Is Lovable safe for a real app? · Hire a Lovable developer