← ClaudeAtlas

vercel-envlisted

Sets Next.js and Vercel environment variables for Stripe and Supabase, including preview vs production webhook secrets. Use when adding .env.example, Vercel env, or debugging webhook signature mismatches across deploy previews.
GThomaz03/vercel-env-skill · ★ 0 · Code & Development · score 65
Install: claude install-skill GThomaz03/vercel-env-skill
# Vercel env for Stripe + Supabase ## Rules - Never commit secrets. Put names only in `.env.example`. - Preview and Production **must not share** `STRIPE_WEBHOOK_SECRET`. Stripe signs each endpoint separately. Mixing them is the usual "works locally, fails on the preview URL" bug. - Server-only keys (`STRIPE_SECRET_KEY`, `SUPABASE_SERVICE_ROLE_KEY`) never get a `NEXT_PUBLIC_` prefix. - `NEXT_PUBLIC_SUPABASE_ANON_KEY` is public by design; protect data with RLS, not by hiding the anon key. ## Required names ``` NEXT_PUBLIC_SUPABASE_URL= NEXT_PUBLIC_SUPABASE_ANON_KEY= SUPABASE_SERVICE_ROLE_KEY= STRIPE_SECRET_KEY= STRIPE_WEBHOOK_SECRET= NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY= STRIPE_PRICE_PRO= ``` Local: `.env.local` (gitignored). Vercel: Project → Settings → Environment Variables. Set Production and Preview separately for webhook secrets. ## Local webhooks ```bash stripe listen --forward-to localhost:3000/api/stripe/webhook ``` Paste the CLI `whsec_...` into `.env.local` as `STRIPE_WEBHOOK_SECRET`. Do not use the Dashboard production secret locally. ## Checklist before asking "why is the signature invalid?" 1. Raw body used in `constructEvent` (not `req.json()`). 2. Secret matches the endpoint that actually received the event (CLI vs Dashboard vs preview vs prod). 3. After changing Vercel env, **redeploy**. Env changes do not hot-reload production.