{"id":5808,"date":"2018-10-23T01:51:00","date_gmt":"2018-10-23T01:51:00","guid":{"rendered":"http:\/\/www.garysieling.com\/blog\/?p=5808"},"modified":"2020-03-30T02:30:35","modified_gmt":"2020-03-30T02:30:35","slug":"aws-lambda-node-index-handler-not-defined","status":"publish","type":"post","link":"https:\/\/www.garysieling.com\/blog\/aws-lambda-node-index-handler-not-defined\/","title":{"rendered":"AWS Lambda + Node: index.handler is not defined"},"content":{"rendered":"<p>If you get an &#8220;index.handler is undefined&#8221; error on AWS lambda, it could be one of a couple things &#8211; essentially their code is doing &#8220;require(&#8216;index&#8217;).handler(event, context, callback)&#8221; and erroring out:<\/p>\n<ul>\n<li>You don&#8217;t have an index.js script<\/li>\n<li>Your index.js script doesn&#8217;t have any exports<\/li>\n<li>Your index.js script has incorrectly named exports<\/li>\n<\/ul>\n<p>What you want is an index.js with the following:<\/p>\n<pre lang=\"javascript\">exports.handler = function(event, context, callback) {\n}\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Fixing javascript errors on AWS lambda<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[8,12],"tags":[71,302,334,387],"aioseo_notices":[],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/5808"}],"collection":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/comments?post=5808"}],"version-history":[{"count":1,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/5808\/revisions"}],"predecessor-version":[{"id":6430,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/5808\/revisions\/6430"}],"wp:attachment":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/media?parent=5808"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/categories?post=5808"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/tags?post=5808"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}