← All errors · Stripe
You did not provide an API key
Exact error
You did not provide an API key. You need to provide your API key in the Authorization header, using Bearer auth.
What it means
A request reached Stripe with no secret key at all, usually because the environment variable was undefined.
Likely causes
- STRIPE_SECRET_KEY not set in this environment (local vs Vercel production/preview).
- Stripe client initialized in browser code where server env vars are not available.
How to fix it
Log whether the variable exists (never log the value): `console.log(!!process.env.STRIPE_SECRET_KEY)`.
Initialize Stripe only in server code (route handlers, server actions):
import Stripe from 'stripe'; export const stripe = new Stripe(process.env.STRIPE_SECRET_KEY);Add the variable on Vercel for every environment that needs it and redeploy.
Related errors
Get new fixes weekly
No spam. Unsubscribe anytime. Privacy