📄 SKILL.md

← Vault

name: lovable-vps-supabase-env-vars

description: Fix HTTP 500 on Lovable/TanStack Start VPS apps caused by wrong Supabase credentials in systemd service

category: devops


Lovable/TanStack Start VPS Deployment — Supabase Env Vars Issue

Symptom

App returns {"status":500,"unhandled":true,"message":"HTTPError"} on ALL routes after deploying. curl shows HTTP 500. The app appears completely broken.

Root Cause

When Lovable apps are deployed to VPS, the systemd service file (/etc/systemd/system/.service) has hardcoded Environment= values for Supabase. These may be:

How to Fix

Edit the systemd service:

`bash

sudo nano /etc/systemd/system/.service

`

Update the Environment= lines to match the correct values from .env:

`ini

Environment="SUPABASE_URL=https://nzaxsorgsecnmqwufawn.supabase.co"

Environment="VITE_SUPABASE_PROJECT_ID=nzaxsorgsecnmqwufawn"

Environment="VITE_SUPABASE_PUBLISHABLE_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."

Environment="VITE_SUPABASE_URL=https://nzaxsorgsecnmqwufawn.supabase.co"

`

Then reload and restart:

`bash

sudo systemctl daemon-reload

sudo systemctl restart

`

Prevention

After any Lovable redeploy that touches environment variables, always check if the systemd service env vars still match the .env file — Lovable's deploy process may not update the service file automatically.