{"record":{"id":"ae74e2a47866321b","repo":"heygen-com/hyperframes","slug":"skip-build-set-but-zip-does-not-exist-run-b","errorCode":null,"errorMessage":"--skip-build set but ${zip} does not exist. Run `bun run --cwd packages/aws-lambda build:zip` first or drop --skip-build.","messagePattern":"--skip-build set but (.+?) does not exist\\. Run `bun run --cwd packages/aws-lambda build:zip` first or drop --skip-build\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/cli/src/commands/lambda/deploy.ts","lineNumber":58,"sourceCode":"    awsProfile: args.awsProfile ?? process.env.AWS_PROFILE,\n    reservedConcurrency: args.reservedConcurrency ?? DEFAULT_CONCURRENCY,\n    chromeSource: args.chromeSource ?? \"sparticuz\",\n    lambdaMemoryMb: args.lambdaMemoryMb ?? DEFAULT_MEMORY_MB,\n    skipBuild: args.skipBuild ?? false,\n  };\n\n  const root = repoRoot();\n  // Locate the SAM template up-front so users get a fast, clear error\n  // (not an opaque `sam deploy` failure) when this isn't a checkout.\n  locateSamTemplate(root);\n\n  if (!resolved.skipBuild) {\n    console.log(c.dim(\"→ Building handler ZIP\"));\n    buildHandlerZip(root);\n  } else {\n    const zip = join(root, \"packages\", \"aws-lambda\", \"dist\", \"handler.zip\");\n    if (!existsSync(zip)) {\n      throw new Error(\n        `--skip-build set but ${zip} does not exist. Run \\`bun run --cwd packages/aws-lambda build:zip\\` first or drop --skip-build.`,\n      );\n    }\n  }\n\n  console.log(c.dim(`→ sam deploy (stack=${resolved.stackName} region=${resolved.region})`));\n  samDeploy({\n    repoRoot: root,\n    stackName: resolved.stackName,\n    region: resolved.region,\n    awsProfile: resolved.awsProfile,\n    reservedConcurrency: resolved.reservedConcurrency,\n    lambdaMemoryMb: resolved.lambdaMemoryMb,\n    chromeSource: resolved.chromeSource,\n  });\n\n  console.log(c.dim(\"→ Reading stack outputs\"));\n  const outputs = fetchStackOutputs({","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/heygen-com/hyperframes/blob/c2996c8626135db5253519359d8a063d3bafad8d/packages/cli/src/commands/lambda/deploy.ts#L40-L76","documentation":"Thrown by runDeploy when `--skip-build` is set but the prebuilt handler ZIP at `<repoRoot>/packages/aws-lambda/dist/handler.zip` does not exist. --skip-build is an optimization for CI that already built the ZIP; this guard prevents a misleading later `sam deploy` failure by checking the artifact is actually present before proceeding.","triggerScenarios":"Running `hyperframes lambda deploy --skip-build` before ever running the build:zip script; running from a fresh checkout where dist/ isn't populated; the ZIP was gitignored and a fresh clone lacks it.","commonSituations":"A CI job split into build + deploy steps where the build step was skipped or failed silently; copying only source between machines; a clean that removed dist/.","solutions":["Run `bun run --cwd packages/aws-lambda build:zip` once to produce the ZIP, then re-run deploy with --skip-build.","Drop `--skip-build` and let the deploy command build the ZIP for you.","In CI, ensure the build step runs (and succeeds) before the deploy step that uses --skip-build."],"exampleFix":"# before\nhyperframes lambda deploy --skip-build  # ZIP missing\n# after — either build first\nbun run --cwd packages/aws-lambda build:zip && hyperframes lambda deploy --skip-build\n# or just let deploy build it\nhyperframes lambda deploy","handlingStrategy":"validation","validationCode":"// Confirm the handler ZIP exists before using --skip-build\nimport { existsSync } from \"node:fs\";\nimport { join } from \"node:path\";\nfunction assertZipReady(repoRoot: string): void {\n  const zip = join(repoRoot, \"packages\", \"aws-lambda\", \"dist\", \"handler.zip\");\n  if (!existsSync(zip)) throw new Error(`Build the ZIP first: bun run --cwd packages/aws-lambda build:zip`);\n}","typeGuard":null,"tryCatchPattern":"try {\n  await runDeploy({ skipBuild: true, /* ... */ });\n} catch (err) {\n  if (/--skip-build set but/.test((err as Error).message))) {\n    // drop --skip-build, or run build:zip first\n  }\n}","preventionTips":["Order CI steps: install → build:zip → deploy --skip-build.","Don't use --skip-build for one-off local deploys; let deploy build the ZIP.","Commit or cache dist/handler.zip in CI to keep --skip-build valid."],"tags":["cli","lambda","deploy","build-artifact","ci"],"backgroundTag":null,"analyzedSha":"c2996c8626135db5253519359d8a063d3bafad8d","analyzedAt":"2026-08-12T22:18:56.877Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}