“Missing environment variable: NEXT_PUBLIC_SANITY_…”
.env is missing or not filled in. Copy .env.example to .env, fill it in, and restart pnpm dev after editing it.
“Missing SANITY_API_READ_TOKEN”
Create a Viewer token in Sanity (API → Tokens) and put it in SANITY_API_READ_TOKEN. See Sanity setup.
The Studio shows a CORS error
Add your URL to Sanity CORS origins with Allow credentials ticked.
Orders stay “pending” after paying
The webhook isn’t reaching the app. Locally, keep stripe listen --forward-to localhost:3000/api/webhook running and use its whsec_… secret. In production, check the endpoint URL and events in Stripe. See Stripe payments.
/admin sends me home
Your account’s primary email must be listed in ADMIN_EMAIL. Restart pnpm dev after changing .env.
Images don’t load
Images come from cdn.sanity.io, which is allowed in next.config.ts. If you add another image host, add it to images.remotePatterns there.
pnpm seed fails
- Sign the CLI in first:
pnpm exec sanity login. - Check
NEXT_PUBLIC_SANITY_PROJECT_IDin.env. - The dataset must exist and be named
production.
Still stuck?
See Support.