The docs for Functions is relatively light on the types involved for the handler, so I had to look at the relevant source code for the CLI to know how precisely the handler was invoked and its result used.
- The
event
parameter (first parameter) is very well explained inline, but it doesn’t explain the factevent.headers['client-ip']
is set to the detected IP regardless of if such a header previously existed. - The
context
parameter has basically no documentation at all in terms of actual property names. This is also nothing like what the AWS parameter of the same name is. - The
callback
is documented as a Node-style callback using equivalent terminology, but the AWS docs it delegates to doesn’t really explain the secondresult
parameter much at all. Based on reading the source code (again):-
result.statusCode
is pretty obvious. -
result.headers
is also pretty obvious. -
result.multiValueHeaders
is wholly undocumented, but it seems redundant withresult.headers
. -
result.body
is the resulting body as a string. -
result.isBase64Encoded
is whether the body is a Base64-encoded string or a raw string.
-
- There is literally nothing in the docs stating you can return a promise in lieu of calling the callback.