When trying to connect an admin wallet on the production site (stadium-nu.vercel.app/admin), you see:
- "Connection failed: Admin account not found"
- Your wallet addresses are listed
- Expected admin addresses shows empty or doesn't match
The VITE_ADMIN_ADDRESSES environment variable is not set in your Vercel production environment, or it's set incorrectly.
Important: Vite environment variables are baked into the build at build time, not runtime. This means:
- Changing
.envlocally doesn't affect production - You must set it in Vercel Dashboard → Environment Variables
- You must redeploy after changing it
- Connect your Polkadot wallet extension
- Copy one of your wallet addresses (the one you want to use as admin)
- Example:
5GE6ptWSLAgSgoDzBDsFgZi1cauUCmEpEgtddyphkL5GGQcF
- Go to Vercel Dashboard
- Select your project (the client app)
- Go to Settings → Environment Variables
- Add a new variable:
- Name:
VITE_ADMIN_ADDRESSES - Value: Your wallet address (comma-separated if multiple)
5GE6ptWSLAgSgoDzBDsFgZi1cauUCmEpEgtddyphkL5GGQcF - Environment: Select Production (and Preview if you want)
- Name:
- Click Save
Critical: After changing environment variables, you must redeploy:
- Go to Deployments tab
- Find the latest deployment
- Click ⋯ (three dots) → Redeploy
- Wait for the build to complete (1-2 minutes)
OR trigger a new deployment by:
- Pushing a commit to your main branch (if Vercel auto-deploys)
- Or running
vercel --prodfrom CLI
- Open your production site:
https://stadium-nu.vercel.app/admin - Open browser console (F12)
- Run:
import.meta.env.VITE_ADMIN_ADDRESSES - It should show your wallet address
- Try connecting your wallet again
To add multiple admin addresses, separate them with commas (no spaces):
VITE_ADMIN_ADDRESSES=5GE6ptWSLAgSgoDzBDsFgZi1cauUCmEpEgtddyphkL5GGQcF,5Di7WRCjywLjV53hVjdBekPo2mLtyZAxQYenvW1vKfMNCyo9
- Hard refresh your browser:
Ctrl+Shift+R(Windows) orCmd+Shift+R(Mac) - Clear browser cache for the site
- Check console for
VITE_ADMIN_ADDRESSESvalue - Verify the address matches exactly (case-insensitive, but check for typos)
- Polkadot addresses are long strings (48+ characters)
- Make sure there are no extra spaces or newlines
- The address should match exactly what your wallet extension shows
- Go to Deployments → latest deployment → Build Logs
- Search for
VITE_ADMIN_ADDRESSES - Verify it's being set correctly during build
For local development, set it in client/.env:
VITE_ADMIN_ADDRESSES=5GE6ptWSLAgSgoDzBDsFgZi1cauUCmEpEgtddyphkL5GGQcFThen restart your dev server (npm run dev).
client/src/lib/constants.ts- ReadsVITE_ADMIN_ADDRESSESand normalizes addressesclient/src/pages/AdminPage.tsx- Admin authentication logicclient/.env.example- Example env file (not used in production)