{"record":{"id":"edaa840d2e275faa","repo":"heygen-com/hyperframes","slug":"build-zip-ffmpeg-static-binary-missing-at-ffmp","errorCode":null,"errorMessage":"[build-zip] ffmpeg-static binary missing at ${ffmpegBinary}. Did postinstall run?","messagePattern":"\\[build-zip\\] ffmpeg-static binary missing at (.+?)\\. Did postinstall run\\?","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/aws-lambda/scripts/build-zip.ts","lineNumber":410,"sourceCode":"  }\n}\n\nfunction stageFfmpeg(stagingDir: string): void {\n  const binDir = join(stagingDir, \"bin\");\n  mkdirSync(binDir, { recursive: true });\n\n  // ffmpeg from `ffmpeg-static`. The package only ships the encoder\n  // binary; the audio pad/trim path also needs ffprobe, which comes\n  // from `ffprobe-static`.\n  //\n  // `ffmpeg-static`'s postinstall fetches a binary for the host platform\n  // (e.g. arm64 Mach-O on Apple Silicon macOS). Lambda runs Linux x86-64,\n  // so a build from a non-Linux host silently produces a zip that boots\n  // but fails at first ffmpeg invocation with `cannot execute binary file`.\n  // Verify the ELF header up front and bail with a clear message instead.\n  const ffmpegBinary = join(resolveModuleDir(\"ffmpeg-static\"), \"ffmpeg\");\n  if (!existsSync(ffmpegBinary)) {\n    throw new Error(\n      `[build-zip] ffmpeg-static binary missing at ${ffmpegBinary}. Did postinstall run?`,\n    );\n  }\n  assertLinuxX86_64Elf(ffmpegBinary, \"ffmpeg-static binary\");\n  const ffmpegDest = join(binDir, \"ffmpeg\");\n  cpSync(ffmpegBinary, ffmpegDest);\n  chmodSync(ffmpegDest, 0o755);\n\n  // ffprobe lives at `ffprobe-static/bin/<platform>/<arch>/ffprobe`.\n  // The producer's `audioPadTrim` spawns `ffprobe` from PATH so we need\n  // it alongside ffmpeg under /var/task/bin/.\n  const ffprobeModule = resolveModuleDir(\"ffprobe-static\");\n  const ffprobeCandidates = [\n    join(ffprobeModule, \"bin\", \"linux\", \"x64\", \"ffprobe\"),\n    join(ffprobeModule, \"bin\", \"linux\", \"arm64\", \"ffprobe\"),\n  ];\n  const ffprobeBinary = ffprobeCandidates.find((p) => existsSync(p));\n  if (!ffprobeBinary) {","sourceCodeStart":392,"sourceCodeEnd":428,"githubUrl":"https://github.com/heygen-com/hyperframes/blob/c2996c8626135db5253519359d8a063d3bafad8d/packages/aws-lambda/scripts/build-zip.ts#L392-L428","documentation":"After resolving the ffmpeg-static module directory, the build checks for a file named 'ffmpeg' (no extension) inside it. If the file does not exist, it throws. This means the ffmpeg-static postinstall script that downloads the prebuilt binary either did not run or failed silently.","triggerScenarios":"ffmpeg-static is present in node_modules but its ffmpeg binary is absent. The postinstall hook was skipped (e.g., --ignore-scripts) or failed due to network issues.","commonSituations":"Installing with --ignore-scripts or with npm_config_ignore_scripts=true; postinstall failed due to network timeout; CI that strips postinstall scripts for security.","solutions":["Reinstall without --ignore-scripts: ensure scripts are not ignored during bun install.","Manually trigger the postinstall: cd node_modules/ffmpeg-static && npm run install.","Check that npm_config_ignore_scripts is not set in the environment."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"import { existsSync } from \"node:fs\";\nimport { join } from \"node:path\";\nconst ffmpegBinary = join(resolveModuleDir(\"ffmpeg-static\"), \"ffmpeg\");\nif (!existsSync(ffmpegBinary)) {\n  console.error(\"ffmpeg-static binary missing. Ensure postinstall ran during install (no --ignore-scripts).\");\n  process.exit(1);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never install with --ignore-scripts for packages that need postinstall downloads.","Verify ffmpeg-static postinstall succeeded in CI logs.","Pin ffmpeg-static to a known-good version."],"tags":["ffmpeg","postinstall","build","dependencies"],"backgroundTag":null,"analyzedSha":"c2996c8626135db5253519359d8a063d3bafad8d","analyzedAt":"2026-08-12T22:18:56.877Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}