← Back to all fixes

Pipeline fails: environment variable not set

The Issue

`CI: Required env var STRIPE_KEY not set` — build fails but works locally.

Root Cause

The variable is in your local `.env` file (not committed) but not added to the CI platform secrets.

How to Fix
  1. Add the secret to your CI platform: GitHub Actions Secrets, GitLab CI Variables, or Jenkins Credentials
  2. Reference it in the pipeline YAML: `env: STRIPE_KEY: ${{ secrets.STRIPE_KEY }}`
  3. Add a validation step at the top of your pipeline: fail fast if required vars are missing
  4. Never commit .env files — use .env.example to document required variables