event token (a key of the app's eventTypeMapSchema)
optional Zod schema validated before the handler
optional Zod schema validated after the handler
keys of the app's global and stage params
OptionalbaseHTTP base path. Defaults to the folders between endpointsRootAbs and the method folder.
import.meta.url of the registering module (required).
OptionalcontentResponse content type. Beats every default (functionDefaults.contentType,
app http.defaults, functionDefaults.http.options and the selected
profile); only this function's own http.options.contentType beats it.
Defaults to the highest of those that is set, else application/json.
OptionalendpointsRoot that method and basePath are derived from.
Defaults to <appRootAbs>/functions/<eventType> (POSIX separators).
OptionaleventZod schema validated before the handler.
OptionaleventEvent token selecting the runtime event type (e.g. 'rest', 'sqs').
Defaults to the first folder under <appRootAbs>/functions that contains
the caller (functions/rest/users/get/lambda.ts gives 'rest'). Throws
at definition time when the caller isn't under functions/<eventType>/ or
that folder isn't a key of the app's eventTypeMapSchema.
OptionalfnExtra env keys exposed to this function (merged with functionDefaults.fnEnvKeys).
OptionalfunctionUnique function name, used as the Serverless function key.
Defaults to functionDefaults.functionName when set, else the caller's
directory relative to appRootAbs, joined with _
(e.g. functions_rest_hello_get).
OptionalhttpHTTP middleware customization for this function: profile selection,
option overrides, extend/transform/replace. Combined with
functionDefaults.http; see FunctionDefaults.http.
OptionalhttpSecurity contexts to expose. Defaults to functionDefaults.httpContexts, else ['public'].
OptionalmethodHTTP method. Defaults to the last folder name (e.g. get).
OptionalresponseZod schema validated after the handler.
OptionalserverlessServerless Framework properties for this function (memorySize,
timeout, tenancy, image, ...), merged key by key over
functionDefaults.serverless (image one level deeper when both are
objects). See FunctionServerlessConfig.
Options accepted by
app.defineFunction(...).Only
callerModuleUrlis required. Every other field is either optional or derived from the file's location under<appRootAbs>/functionsand the app'sfunctionDefaults. An explicit value always wins over a derived or defaulted one.Derivation gives the same result inside a deployed bundle: when esbuild inlines the app config into the function, so
appRootAbspoints inside afunctionsfolder and the caller isn't under<appRootAbs>/functions, the root is the folder holding the caller's lastfunctions/<eventType>/(<eventType>a key of the app'seventTypeMapSchema). Read<appRootAbs>below as that root.