{"record":{"id":"a110b8ade953e588","repo":"heygen-com/hyperframes","slug":"lambda-sam-template-not-found-at-candidate-i","errorCode":null,"errorMessage":"[lambda] SAM template not found at ${candidate}. If you're running from an installed package, point --sam-template at your local copy of examples/aws-lambda/template.yaml.","messagePattern":"\\[lambda\\] SAM template not found at (.+?)\\. If you're running from an installed package, point --sam-template at your local copy of examples/aws-lambda/template\\.yaml\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/cli/src/commands/lambda/sam.ts","lineNumber":71,"sourceCode":"  awsProfile?: string;\n  reservedConcurrency?: number;\n  /** Lambda memory in MB. Forwarded as the `LambdaMemoryMb` parameter override. */\n  lambdaMemoryMb?: number;\n  chromeSource?: \"sparticuz\" | \"chrome-headless-shell\";\n  /** Pass-through stdio. Defaults to \"inherit\" so SAM's progress lines stream live. */\n  stdio?: \"inherit\" | \"pipe\";\n}\n\n/**\n * Resolve the SAM template path relative to `repoRoot`. We look for the\n * `examples/aws-lambda/template.yaml` first (development checkout) and\n * fall back to the installed-package layout when running from a globally\n * installed `hyperframes` CLI.\n */\nexport function locateSamTemplate(repoRoot: string): string {\n  const candidate = join(repoRoot, \"examples\", \"aws-lambda\", \"template.yaml\");\n  if (!existsSync(candidate)) {\n    throw new Error(\n      `[lambda] SAM template not found at ${candidate}. ` +\n        `If you're running from an installed package, point --sam-template at your local copy of examples/aws-lambda/template.yaml.`,\n    );\n  }\n  return candidate;\n}\n\n/** Run `sam deploy` non-interactively. Returns when SAM exits 0; throws on non-zero. */\nexport function samDeploy(opts: DeployOptions): void {\n  assertSamAvailable();\n  const paramOverrides = [\n    `ChromeSource=${opts.chromeSource ?? \"sparticuz\"}`,\n    `ReservedConcurrency=${opts.reservedConcurrency ?? -1}`,\n  ];\n  if (opts.lambdaMemoryMb !== undefined) {\n    paramOverrides.push(`LambdaMemoryMb=${opts.lambdaMemoryMb}`);\n  }\n  const args = [","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/heygen-com/hyperframes/blob/c2996c8626135db5253519359d8a063d3bafad8d/packages/cli/src/commands/lambda/sam.ts#L53-L89","documentation":"Thrown by locateSamTemplate() in packages/cli/src/commands/lambda/sam.ts:68. The Lambda deploy path expects `examples/aws-lambda/template.yaml` to exist under repoRoot. It checks that single candidate with existsSync and throws if absent. This is the dev-checkout layout; installed npm packages don't ship the examples tree, so the flag --sam-template is the documented escape hatch.","triggerScenarios":"Calling samDeploy/locateSamTemplate with a repoRoot that does not contain examples/aws-lambda/template.yaml — most often running from a globally installed `hyperframes` CLI, from inside node_modules, or with --repo-root pointed at the wrong directory.","commonSituations":"Global `hyperframes` install (no examples dir in package output); running the CLI from a project that isn't the HyperFrames repo checkout; template deleted or moved; wrong --repo-root value.","solutions":["If you have the source repo, point --repo-root (or cwd) at the checkout root so examples/aws-lambda/template.yaml resolves.","If running from an installed package, copy examples/aws-lambda/template.yaml out of the repo and pass its path via --sam-template.","Verify the file actually exists: `ls examples/aws-lambda/template.yaml` from the directory you pass as repo root.","Reinstall/refresh the package if you expected the template to ship and it's missing."],"exampleFix":"# before (installed package, template missing)\nhyperframes lambda deploy --repo-root .\n# after\nhyperframes lambda deploy --sam-template /abs/path/to/template.yaml","handlingStrategy":"validation","validationCode":"import { existsSync } from 'node:fs';\nimport { join } from 'node:path';\n\nfunction resolveSamTemplate(repoRoot: string, override?: string): string {\n  const path = override ?? join(repoRoot, 'examples', 'aws-lambda', 'template.yaml');\n  if (!existsSync(path)) {\n    throw new Error(`Template not found: ${path}. Pass --sam-template <path>.`);\n  }\n  return path;\n}","typeGuard":null,"tryCatchPattern":"try {\n  locateSamTemplate(repoRoot);\n} catch (error) {\n  if (/SAM template not found/.test(String(error))) {\n    // fall back to an explicit --sam-template arg the user supplied\n    locateSamTemplate(explicitTemplatePath);\n  } else throw error;\n}","preventionTips":["Always pass --sam-template explicitly when running from an installed package.","In CI, check out the HyperFrames repo or vendor the template file alongside your deploy script.","Assert the template file exists in a preflight step before invoking deploy."],"tags":["lambda","deployment","filesystem","sam"],"backgroundTag":null,"analyzedSha":"c2996c8626135db5253519359d8a063d3bafad8d","analyzedAt":"2026-08-12T22:18:56.877Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}