pitcheye.dev← All 30 rules
severity: warnpack: vercelv1.0 core

vercel/env-parity-drift

Missing secret env var is swallowed instead of failing fast

npx @pitcheye/check . --pack vercel

whyItBreaks

Environment variables are per-scope on Vercel: a key set in Production is absent in Preview unless someone added it. Code that warns-and-skips turns that drift into a silent behaviour difference — receipts "sent" in production, silently dropped in preview — and nobody sees it until a customer does.

✖ Bad — triggers warnfixtures/vercel-env-parity-drift/bad
const key = process.env.RESEND_API_KEY;
if (!key) { console.warn("missing"); return { skipped: true }; }
✓ Good — passes checkfixtures/vercel-env-parity-drift/good
const key = process.env.RESEND_API_KEY;
if (!key) throw new Error("RESEND_API_KEY is not set in this environment");

suggestedFix

Fail loudly at the boundary: `if (!key) throw new Error("RESEND_API_KEY is not set in this environment")`. Validate required env in one module loaded at boot so a missing key breaks the deploy, not one feature.

explain_rule({"vercel/env-parity-drift"})

Agent & MCP JSON output contract

{
  "ruleId": "vercel/env-parity-drift",
  "pack": "vercel",
  "severity": "warn",
  "file": "vercel.json",
  "line": 6,
  "message": "a `process.env.<SECRET>` read whose absent branch only `console.warn`s and skips work",
  "whyItBreaks": "Environment variables are per-scope on Vercel: a key set in Production is absent in Preview unless someone added it. Code that warns-and-skips turns that drift into a silent behaviour difference — receipts \"sent\" in production, silently dropped in preview — and nobody sees it until a customer does.",
  "suggestedFix": "Fail loudly at the boundary: `if (!key) throw new Error(\"RESEND_API_KEY is not set in this environment\")`. Validate required env in one module loaded at boot so a missing key breaks the deploy, not one feature.",
  "docsUrl": "https://pitcheye.dev/rules/vercel-env-parity-drift"
}

Markdown: curl -H "Accept: text/markdown" https://pitcheye.dev/rules/vercel-env-parity-drift

raw markdown
# vercel/env-parity-drift

- **severity:** warn
- **pack:** vercel
- **docs:** https://pitcheye.dev/rules/vercel-env-parity-drift

## whyItBreaks

Environment variables are per-scope on Vercel: a key set in Production is absent in Preview unless someone added it. Code that warns-and-skips turns that drift into a silent behaviour difference — receipts "sent" in production, silently dropped in preview — and nobody sees it until a customer does.

## bad

```ts
const key = process.env.RESEND_API_KEY;
if (!key) { console.warn("missing"); return { skipped: true }; }
```

## good

```ts
const key = process.env.RESEND_API_KEY;
if (!key) throw new Error("RESEND_API_KEY is not set in this environment");
```

## suggestedFix

Fail loudly at the boundary: `if (!key) throw new Error("RESEND_API_KEY is not set in this environment")`. Validate required env in one module loaded at boot so a missing key breaks the deploy, not one feature.

## commands

```bash
npx @pitcheye/check . --pack vercel
```

```json
{"tool":"explain_rule","arguments":{"ruleId":"vercel/env-parity-drift"}}
```
← vercel/hobby-cron-violationBack to rule catalogvercel/serverless-budget-guard →