Skip to main content

Module call

Module call 

Source
Expand description

Invoking one function without serving anything — the apiplant call command, and what a Kubernetes CronJob runs.

A scheduled job wants exactly what an HTTP call to <base>/functions/{name} does, minus the server: the same function, the same database, the same email/cache/payments/AI services built from the same main.toml. So this builds those services the way crate::run_with does, hands the function a HostBridge over them, and returns what it returned.

Two deliberate differences from the HTTP path:

  • No access check. There is no request to authenticate and no session to read; whoever can run the binary against the database has already got more than any endpoint would give them. --as <USER_ID> sets the principal the function sees, for a function that reads it.
  • Visibility is ignored. A Private function has no route on purpose — it exists to be called from a hook — and a cron job is that same kind of caller, so it can call one.

Migrations are not run: a job that starts by migrating is a job that can migrate a production database at 3am because it was scheduled to.

Structs§

Options
How to call.

Functions§

call
Run one of the app’s functions and return its JSON result.