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
eventparameter (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
contextparameter 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
callbackis documented as a Node-style callback using equivalent terminology, but the AWS docs it delegates to doesn’t really explain the secondresultparameter much at all. Based on reading the source code (again):-
result.statusCodeis pretty obvious. -
result.headersis also pretty obvious. -
result.multiValueHeadersis wholly undocumented, but it seems redundant withresult.headers. -
result.bodyis the resulting body as a string. -
result.isBase64Encodedis 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.