Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in AWS by (19.1k points)

As my title explains I am getting the following error:

 {

  "errorMessage": "Cannot find module 'index'",

  "errorType": "Error",

  "stackTrace": [

    "Function.Module._resolveFilename (module.js:338:15)",

    "Function.Module._load (module.js:280:25)",

    "Module.require (module.js:364:17)",

    "require (module.js:380:17)"

  ]

}

I have tried both solutions provided in creating-a-lambda-function-in-aws-from-zip-file and simple-node-js-example-in-aws-lambda

My config currently looks like:

image

and my file structure is: 

image

and my index.js handler function looks like :

exports.handler = function(event, context) {

What else could be causing this issue aside from what was stated in those two answers above? I have tried both solutions and I have also allocated more memory to the function just incase that's why it couldn't run.

For the sake of trying, I created an even simpler version of my original code and it looked like this:

var Q = require('q');

var AWS = require('aws-sdk');

var validate = require('lambduh-validate');

var Lambda = new AWS.Lambda();

var S3 = new AWS.S3();




 

theHandler = function (event, context) {

  console.log =('nothing');

}

exports.handler = theHandler();

And yet still does not work with the same error?

1 Answer

0 votes
by (44.4k points)

Instead of zipping the folder or the directory, ZIP the file contents of the folder lambda_create_timelapse and upload it.

Related questions

Want to get 50% Hike on your Salary?

Learn how we helped 50,000+ professionals like you !

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...