Skip to content
Latchkey

Cloud Functions "Build failed: function ... entry point not found" in CI

The Cloud Functions build looked for the function named by --entry-point and could not find a matching exported symbol in the deployed source. The build fails before the function is ever created.

What this error means

gcloud functions deploy fails with "Build failed: ... function 'X' is not defined in the provided code" or "entry point not found", where X is the --entry-point you passed.

gcloud
ERROR: (gcloud.functions.deploy) OperationError: code=3, message=Build failed:
function 'handler' is not defined in the provided code. Did you specify the right
entry point? Please visit https://cloud.google.com/functions/docs/troubleshooting

Common causes

The entry point name does not match the export

The function is exported under a different name than the --entry-point value (a typo, or the source defines main while CI passes handler).

The handler is not exported from the expected file

For Node the symbol must be on exports/module.exports; for Python it must be a top-level function in main.py. A nested or unexported function is not found.

How to fix it

Match --entry-point to the exported symbol

  1. Open the source and note the exact exported function name.
  2. Pass that name to --entry-point on the deploy command.
  3. Redeploy and confirm the build finds the function.
Terminal
gcloud functions deploy api \
  --runtime python312 --trigger-http --entry-point main

Export the handler at the top level

Ensure the function is exported from the entry file the runtime expects (main.py for Python, index.js for Node).

main.py
# main.py (Python runtime)
def main(request):
    return "ok"

How to prevent it

  • Keep the --entry-point value in sync with the exported function name.
  • Define handlers as top-level exports in the runtime entry file.
  • Deploy from the directory that actually contains the source.

Frequently asked questions

What causes ""entry point not found""?
The function is exported under a different name than the --entry-point value (a typo, or the source defines main while CI passes handler).
How do I fix "entry point not found"?
Match --entry-point to the exported symbol

Related guides

References

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