In Node.js, Amazon Lambda functions have a signature that looks like this
exports.handler = async function (event, context) {
// TODO implement
const response = {
statusCode: 200,
body: JSON.stringify('Hello from Lambda July 20!'),
};
return response
};
The event parameter contains information about the AWS Service Event that triggered the Lambda. The context parameter contains information about the Lambda environment itself.
The context object is documented here. Per those docs, it has a single method named getRemainingTimeInMillis and a number of properties.
However, if I log this object, I see the following
INFO {
callbackWaitsForEmptyEventLoop: [Getter/Setter],
succeed: [Function (anonymous)],
fail: [Function (anonymous)],
done: [Function (anonymous)],
functionVersion: '$LATEST',
functionName: 'july-2021-delete-after-july-31',
memoryLimitInMB: '128',
logGroupName: '/aws/lambda/july-2021-delete-after-july-31',
logStreamName: '2021/07/15/[$LATEST]e05ac24e44d6489b9f8124791b3d5513',
clientContext: undefined,
identity: undefined,
invokedFunctionArn: '...',
awsRequestId: '7852dc1a-8283-46a1-b445-e6d6187553b6',
getRemainingTimeInMillis: [Function: getRemainingTimeInMillis]
}
That is, there's three additional methods named succeed, fail, and done.
succeed: [Function (anonymous)],
fail: [Function (anonymous)],
done: [Function (anonymous)],
What are these methods for, exactly? I can take some guesses and Googling around leads to some circumstantial evidence that they're deprecated methods, but I can't seem to find any documentation on what they're meant to do or how they work.