The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

ignatz (2) [Avatar] Offline
#1
Line 3 creates an error:
exports.handler = function(event, context, callback) => {

The area below shows the result returned by your function execution using the context methods. Learn more about returning results from your function.
{
  "errorMessage": "Unexpected token =>",
  "errorType": "SyntaxError",
  "stackTrace": [
    "Module._compile (module.js:373:25)",
    "Object.Module._extensions..js (module.js:416:10)",
    "Module.load (module.js:343:32)",
    "Function.Module._load (module.js:300:12)",
    "Module.require (module.js:353:17)",
    "require (internal/module.js:12:17)"
  ]
}


should be:
exports.handler = function(event, context, callback) {
Danilo Poccia (11) [Avatar] Offline
#2
Thank you for your feedback, I adapted the code to the new AWS Lambda support for Node.js 4.3 and I introduced a typo.

You can either use what you suggest, or the new compact syntax for anonymous functions in ES6:

exports.handler = (event, context, callback) => {

I'll fix it as soon as possible for the next releases.

Best,
dp
theoxylo (15) [Avatar] Offline
#3
I vote for old school "function " (with a space):

exports.handler = function (event, context, callback) {

or even temp named:

exports.handler = function addTimestamp(event, context, callback) {

Thanks smilie