Function failing
Symptom. Dispatch jobs or scheduled jobs that target a function fail or keep retrying; callers of
a function’s endpoints get 4xx or 5xx; a newly deployed version is never promoted; the runner’s
error rate (fc_fn_invocations_total by outcome) rises.
1. Read the answer
Section titled “1. Read the answer”Every refusal from a runner carries a code, and the runner’s fc_fn_invocations_total labels each
call with its outcome. For deliveries, the dispatch job’s attempts show the status and body the
runner answered (console job drawer, or GET /api/dispatch-jobs/{id}/attempts).
| Answer | Cause | Action |
|---|---|---|
500 FUNCTION_FAILED |
The function’s handler returned an error, panicked or threw | Read the runner’s log line function failed (with the error), and the trace. Fix forward or roll back (below) |
500 FUNCTION_FAILED |
The function exceeded its own memory limit (64 MB unless set) | Raise the function’s memory limit, or fix the leak |
500 FUNCTION_FAILED |
The function returned something the runner could not read | A build or SDK mismatch: rebuild with a supported SDK |
502 FUNCTION_BAD_RESPONSE |
The function returned an out-of-range status | Fix the function |
504 FUNCTION_TIMEOUT |
The call ran past its deadline (30 s unless set, per function or endpoint) | Make it faster, or raise the timeout |
429 FUNCTION_BUSY |
The function is at its concurrency limit (16 unless set) on that runner | Normally nothing: deliveries treat it as a deferral and try again without spending an attempt. If it persists, raise the limit or add runner replicas |
503 FUNCTION_UNAVAILABLE |
No loaded version, the runner is out of memory budget, the version failed to instantiate, or the runner is shutting down | See step 2 |
503 FUNCTION_PREPARING |
The version is still loading | Wait; see step 2 if it lasts |
503 WEBHOOK_SECRET_PENDING |
The signing account’s secret has not reached this runner yet | Clears at the runner’s next desired-state refresh; retried automatically |
401 INVALID_SIGNATURE, UNAUTHENTICATED |
The caller’s signature or credentials do not match what the endpoint requires | Check which service account signs the deliveries and the endpoint’s auth setting |
404 FUNCTION_NOT_FOUND, ROUTE_NOT_FOUND, VERSION_NOT_FOUND |
The runner has no such function, path or version | Wrong pool or URL (step 3), or the endpoint path changed |
413 BODY_TOO_LARGE |
Request body over the limit (1 MiB unless set) | Raise the endpoint’s limit or send less |
2. A version that will not load
Section titled “2. A version that will not load”fcdev fn status <function> (or the function’s page in the console) shows each version’s state on
each runner.
- Permanent failures (the artifact is missing, its digest does not match, the module or bundle is
invalid, it does not compile) are reported
FAILEDat once, with the reason. Fix the build and publish again. - Transient failures (the platform or the artifact store cannot be reached) keep the version
preparing and are retried with backoff for up to
FC_FUNCTIONS_LOAD_RETRY_BUDGET_SECONDS(300) before it is reportedFAILEDwith the attempt count. Check that the platform can reach the artifact store (S3 permissions, or the sharedfile://volume mounted on every platform replica) and that the runner can reach the platform. After fixing it, publishing the same artifact again queues the load once more. - Memory.
fc_fn_memory_refused_totalrising andno_memoryoutcomes mean the runner’s budget is full. Give the runner more memory, move heavy functions to their own runner pool, or lower functions’ memory limits.
A version must be loaded before it can be promoted; promotion is also refused while a config key, secret or database the version declares has no value.
3. Deliveries that never reach the runner
Section titled “3. Deliveries that never reach the runner”- The pool’s URL. The platform builds delivery targets from
FC_FUNCTIONS_RUNNER_URLwith{pool}substituted; a function in a pool with no runner deployment, or a template that does not resolve, fails at connection time. - JVM functions are delivered to
FC_FUNCTIONS_RUNNER_URL_JVM(the ingestor). Without it, they are sent to the WebAssembly runner, which does not run jars and answers that it has no such function. The ingestor’s account also needsplatform:function-runner, and the ingestor must haveINGEST_FUNCTIONS_ENABLED=trueand the rightINGEST_FUNCTIONS_POOL. - Busy runners during a deploy answer
503while draining; deliveries retry.
4. Look inside: traces and logs
Section titled “4. Look inside: traces and logs”- Runner logs name the function address, version and invocation id on every failure
(
function failed,function ran out of memory,function version unavailable,function instantiate failed,function returned a malformed response). - Trace logs. Switch a function’s trace context on for a bounded time
(
fcdev fn trace, orPUT /api/functions/{id}/trace/{context}). The built-inhttpcontext records each call’s request and response (at most 15 minutes at a time); declared contexts record what the function chose to trace. See trace a function. - JVM functions log through the ingestor. A function that throws is logged in full once with the stack trace, then once a minute with a count; a function over its log budget has lines dropped, with one warning a minute saying how many.
5. Roll back or fix forward
Section titled “5. Roll back or fix forward”The live alias decides what subscriptions, schedules and ordinary calls reach. Rolling back is
pointing it at the previous good version:
fcdev fn promote billing.invoice-pdf 6 # or PUT /api/functions/{id}/aliases/liveThe change takes effect at once. Then requeue the jobs that failed meanwhile (requeue and redrive), filtered to the function’s subscription or job code and the incident’s window.
6. A runner that is itself unhealthy
Section titled “6. A runner that is itself unhealthy”fc_fn_stuck_calls counts JavaScript calls that ran past their deadline and could not be stopped.
At four, the runner’s /healthz fails so that the orchestrator replaces the process. If a runner
restarts repeatedly for this reason, one function is looping: find it in the logs by the deadline
messages and roll it back.