Missing documentation for function prototype of `exports.handler` in functions

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 fact event.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 second result 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 with result.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.

thanks for this, @isiahmeadows! I’ll pass this back to our docs team and they can take a closer look! That make take some time, as that team is currently very busy, in the mean time, did you have any specific issues of concerns you needed help with?