Firebase "Failed to load function definition from source" in CI
The functions emulator or deploy loader could not import the source module. The compiled entry point is missing, or an import in it fails, so no function definitions can be read.
What this error means
A deploy or emulator start fails with "Error: Failed to load function definition from source: Failed to generate manifest from function source".
Error: Failed to load function definition from source: Failed to generate manifest from function sourceCommon causes
The compiled entry point is missing
The main field in functions/package.json points at build output that was never produced in CI.
An import in the entry point fails
A missing dependency or a broken relative import stops the module from loading.
How to fix it
Build so the entry point exists
- Confirm
maininfunctions/package.jsonmatches your build output. - Run the build before deploy so that file exists.
- Deploy after a successful build.
{
"main": "lib/index.js",
"scripts": { "build": "tsc" }
}Verify imports resolve
Install functions dependencies and check relative import paths so the entry module loads cleanly.
How to prevent it
- Keep
mainpointed at the real build output. - Build functions before every deploy in CI.
- Install functions dependencies in the functions folder.