{
  "slug": "sam-env-vars-accepts-env-file-format-a2f0c8405205",
  "title": "sam --env-vars accepts .env file format",
  "tools": [
    "sam"
  ],
  "tags": [
    "agent"
  ],
  "introduced_at": "2026-03-19T18:54:12.000Z",
  "announced_at": "2026-03-19T18:54:12.000Z",
  "effective_at": null,
  "date_basis": "source-publication",
  "status": "unknown",
  "how": {
    "incantation": "When setting local environment variables for SAM, put global `KEY=value` entries in a `.env` file, then pass its path to `sam local invoke` or `sam local start-api` with `--env-vars`.",
    "examples": [
      "sam local invoke --env-vars .env",
      "sam local start-api --env-vars .env"
    ],
    "gotchas": [
      "Version: v1.156.0",
      "--env-vars, -n <PATH>: Path to a JSON or `.env` file with Lambda environment variable values; format is detected automatically. `.env` values apply globally; function-specific overrides require JSON.",
      "Prerequisite: Create a `.env` file with `KEY=value` lines. Comments starting with `#` and quoted values are supported; `.env` files only support global variables."
    ]
  },
  "why_it_matters": "Set environment variables for a local SAM workflow using a .env file.",
  "sources": [
    "https://github.com/aws/aws-sam-cli/releases/tag/v1.156.0",
    "https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-using-invoke.html",
    "https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-cli-command-reference-sam-local-invoke.html"
  ],
  "rank": 0.97031,
  "judge": {
    "publish": true,
    "judge_model": "codex-cli/gpt-6-luna+typesafe/jev-1.13.0",
    "prompt_version": "extract-v7+enrich-v2+judge-v2x3+jev-publish-v1"
  },
  "review_state": "approved",
  "provenance": {
    "run_id": "wave2a-20261017",
    "verdict_id": "wave2a-20261017:wave2a-20261017-01977f131939f3fc-0:gate",
    "evidence_hash": "8298d8ca30d9fc0cb6be0052843ecfce056b89b53de2ddc850d76a79217160e7"
  },
  "review": {
    "draft_hash": "dcee1fce06068b41a83908b0865a83a7aee9f5fbdd1f9288ded1e979651597ab",
    "reviewer": "publication-gate",
    "reviewed_at": "2026-10-07T00:00:00.000Z",
    "decision": "wave2a-20261017:gate",
    "reason": "3 of 3 judge runs approved with p_yes >= 0.9 (mean 0.97 >= 0.9; 2 needed) and Jev gave 0.60 (>= 0.6 needed)."
  }
}
