Expand description
The serverless-pre-function node — runs one or more inline Lua functions
against the Context, threading it through each in sequence.
Port of APISIX’s serverless-pre-function plugin. In APISIX the two
serverless plugins (serverless-pre-function / serverless-post-function)
are identical except for the phase they run in; here they share all logic
(ServerlessRunner) and differ only in their registered node-type name.
§Deviations from APISIX
- Function contract. APISIX functions are
return function(conf, ctx) ... endchunks invoked with(conf, ctx). featherbit reuses thescriptplugin’s Lua runtime, so each function is a script that defines a globalfunction execute(ctx) ... return ctx end, receiving and returning the marshalled Context table (see thescriptplugin docs for the table shape). This is the same contract as thescriptnode. - Phase by graph position. APISIX’s
phasefield selects a request lifecycle phase. featherbit expresses phase through placement in the policy graph: aserverless-pre-functionnode is wired before theupstreamnode, aserverless-post-functionnode after it. Thephaseconfig key is accepted for compatibility but is inert.
Structs§
- Serverless
PreFunction Plugin - The
serverless-pre-functionnode. Runs its Lua functions before the upstream call (by convention of its graph placement). - Serverless
Runner - Shared engine behind both serverless nodes: a compiled list of Lua functions run in order against the Context.