Missing Environment Variable

Used in this guide:
Next.js 15.3.4
Vercel

Error:

Error: Neither apiKey nor config.authenticator provided


If you see this error when deploying your Next.js app to Vercel, it typically means your app is trying to access an external service (like Sanity, Stripe, R2, or others) but required environment variables are missing in your deployed environment.


Solution

  • Go to your project on Vercel > Settings > Environment variables
  • Add any required environment variables that you’re using locally but forgot to define on Vercel

example:

  • SANITY_API_KEY
  • R2_ACCESS_KEY_ID
  • R2_SECRET_ACCESS_KEY
  • STRIPE_SECRET_KEY

Tip: You can also redeploy by clicking the Redeploy button again after making these changes.

JKT

Stay focused, and the rest will follow

©Jakkrit Turner. All rights reserved