http://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-handler.html
Using the Callback Parameter
The Node.js runtimes v4.3 and v6.10 support the optional callback
parameter. You can use it to explicitly return information back to the caller.
The general syntax is:
callback(Error error, Object result);
Where:
-
error
– is an optional parameter that you can
use to provide results of the failed Lambda function execution. When
a Lambda function succeeds, you can pass null as the first
parameter.
-
result
– is an optional parameter that you can
use to provide the result of a successful function execution. The
result provided must be JSON.stringify
compatible. If
an error is provided, this parameter is ignored.
Note
Using the callback
parameter is optional. If you don't use the
optional callback
parameter, the behavior is same as if you called the
callback()
without any parameters. You can specify the
callback
in your code to return information to the
caller.