Skip to main content

serverless-post-function

serverless-post-function

Identical to serverless-pre-function in every respect except its conventional placement: it sits after the upstream node, so its functions typically inspect or rewrite ctx.response.

Configuration

Same shape as serverless-pre-function.

KeyTypeDefaultDescription
functionsarray of strings— (required, ≥1)Each string is Lua source defining a global execute(ctx) function. Compiled at config load.
phasestringAccepted for config compatibility, but inert — phase is expressed by the node's placement in the graph.
timeout_msinteger5000Per-function execution timeout (stored, not yet enforced).
modules_pathstringDirectory the sandboxed require resolves modules from.
- id: post
type: serverless-post-function
config:
phase: body_filter # accepted for compatibility; inert
functions:
- |
function execute(ctx)
ctx.response.headers["x-served-by"] = {"featherbit"}
return ctx
end

Behavior

See serverless-pre-function → Behavior. Functions compile at policy-compile time, run in order in fresh VMs threading the Context, succeed through the success port, and propagate the first error through the error port.

Behavior notes

See serverless-pre-function → Behavior notes. Each function defines a global execute(ctx) and returns the Context, and phase is expressed by the node's position in the graph (this node after upstream).