AWS Lambda + Node: index.handler is not defined

If you get an “index.handler is undefined” error on AWS lambda, it could be one of a couple things – essentially their code is doing “require(‘index’).handler(event, context, callback)” and erroring out:

  • You don’t have an index.js script
  • Your index.js script doesn’t have any exports
  • Your index.js script has incorrectly named exports

What you want is an index.js with the following:

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