Articles → AWS → AWS Lambda Function Handler
AWS Lambda Function Handler
Purpose
Async Handlers
exports.handler = async (event) => {
// TODO implement
const response = {
statusCode: 200,
body: JSON.stringify('Hello from Lambda!'),
};
return response;
};
Click to Enlarge
Non-Async Handlers
exports.handler = (event,context,callback) => {
// TODO implement
const response = {
statusCode: 200,
body: JSON.stringify('Hello from Lambda!'),
};
callback(null, response);
};
Click to Enlarge
Arguments In The Handler Method
- Event object → This object contains the information about the invoker
- Context object → This object contains information about the invocation, function, and execution environment
- Callback → This argument is used to send a response from the non-async handlers