Skip to content
Latchkey

Azure Functions "Worker was unable to load function" in CI

The Functions host handed the function to the language worker, and the worker threw while loading it. The entry file is missing, the module failed to import, or the entryPoint export name does not exist in the loaded module.

What this error means

The host logs "Worker was unable to load function X: '...'" followed by a language-specific import or reference error, and that function returns 500 or never becomes callable.

azure
Worker was unable to load function httpTrigger: 'Cannot find module '../dist/httpTrigger''
Function 'httpTrigger' failed to load

Common causes

The entry file path is wrong

function.json scriptFile points at a path that does not exist in the built output, so the worker cannot import it.

The entryPoint export is missing

The module loads but does not export the name given in entryPoint, so the worker has nothing to register.

How to fix it

Point scriptFile at the real built module

  1. Confirm the compiled file exists at the scriptFile path.
  2. Ensure the exported symbol matches entryPoint.
  3. Rebuild and restart the host.
function.json
{
  "scriptFile": "../dist/httpTrigger/index.js",
  "entryPoint": "run"
}

Export the entryPoint name

Make sure the module exports exactly the symbol the worker loads.

index.js
module.exports.run = async function (context, req) { /* ... */ };

How to prevent it

  • Keep scriptFile and entryPoint aligned with build output.
  • Build before starting the host so entry modules exist.
  • Add a startup smoke test that asserts each function loads.

Frequently asked questions

What causes ""Worker was unable to load function""?
function.json scriptFile points at a path that does not exist in the built output, so the worker cannot import it.
How do I fix "Worker was unable to load function"?
Point scriptFile at the real built module

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card