{
  "slug": "supabase-functions-serve-loads-per-function-env-files-77b88f030120",
  "title": "supabase functions serve loads per-function env files",
  "tools": [
    "supabase"
  ],
  "tags": [
    "agent"
  ],
  "introduced_at": "2026-08-18T10:35:36.000Z",
  "announced_at": "2026-08-18T10:35:36.000Z",
  "effective_at": null,
  "date_basis": "source-publication",
  "status": "unknown",
  "how": {
    "incantation": "When serving functions locally with the Supabase CLI v2.115.0, put each function’s values in `supabase/functions/<slug>/.env` and shared values in `supabase/functions/.env`. Run `supabase functions serve`; pass `--env-file <path>` to use that file instead of automatic discovery.",
    "examples": [
      "supabase functions serve",
      "supabase functions serve --env-file <path>"
    ],
    "gotchas": [
      "Version: v2.115.0",
      "--env-file <path>: Path to an env file populated into the Function environment; when explicit, it takes precedence and disables automatic reads.",
      "supabase/functions/.env: Shared local Edge Function secrets file; loaded when the local stack starts.",
      "supabase/functions/<slug>/.env: Per-function env file; overrides matching shared-file values for that function only.",
      "Prerequisite: Use CLI v2.115.0 or later for per-function env discovery.",
      "Prerequisite: Create the env files with the values needed by the functions; the Supabase docs advise adding env files to `.gitignore`.",
      "Per-function and shared env files are discovered by standalone `supabase functions serve`.",
      "`supabase start` does not load these files."
    ]
  },
  "why_it_matters": "Serve functions locally with environment values specific to each function.",
  "before": "Before per-function discovery, the Go CLI read only the shared env fallback; the per-function discovery change is documented as TS-only.",
  "sources": [
    "https://github.com/supabase/cli/releases/tag/v2.115.0",
    "https://github.com/supabase/cli/blob/v2.115.0/apps/cli/docs/go-cli-divergences.md",
    "https://github.com/supabase/cli/blob/v2.115.0/apps/cli/docs/go-cli-reference.md",
    "https://github.com/supabase/supabase/blob/master/apps/docs/content/guides/functions/secrets.mdx"
  ],
  "rank": 0.95033,
  "judge": {
    "publish": true,
    "judge_model": "codex-cli/gpt-6-luna+typesafe/jev-1.13.0",
    "prompt_version": "extract-v7+enrich-v1+judge-v2x3+jev-publish-v1"
  },
  "review_state": "approved",
  "provenance": {
    "run_id": "augsep-20261008",
    "verdict_id": "augsep-20261008:augsep-20261008-4ac016103477069c-6:gate",
    "evidence_hash": "67312730b38126ad51f344ac633e43f8636512cbf1884b7393dc1e44f0fddf05"
  },
  "review": {
    "draft_hash": "c0218cd9ff9ff3167e4f0468c08beb7e18e5ddb620173006ab2db5921c2b76e1",
    "reviewer": "publication-gate",
    "reviewed_at": "2026-10-07T00:00:00.000Z",
    "decision": "augsep-20261008:gate",
    "reason": "3 of 3 judge runs approved with p_yes >= 0.9 (mean 0.95 >= 0.9; 2 needed) and Jev gave 0.67 (>= 0.6 needed)."
  }
}
