When using async do not need to use callback?

1

I have the following function in nodeJs v10.6:

#func-1
module.exports.funcOne = (event, context, callback) => { 
  callback(null, { message: 'funcOne', event });
};

#func-2
module.exports.funcTwo = async (event, context) => { 
  console.log("value1 = " + event.key1);
  console.log("value2 = " + event.key2);  
  return 'some success message';
};

When I run the command on the terminal: sls invoke local --function funcOne I have the answer:

{
    "message": "funcOne",
    "event": ""
}

And when I run the command sls invoke local --function funcTwo I get the answer:

value1 = undefined
value2 = undefined

I can not see some success message ;

I'm following the AWS documentation for lambda functions and NodeJs trying to understand the asynchronous functions with callbacks.

Can anyone explain why I do not see the string in the second example?

    
asked by anonymous 03.08.2018 / 21:27

0 answers