Your handler setup looks different to that described in https://docs.aws.amazon.com/lambda/latest/dg/nodejs-handler.html - are you sure it's equivalent? I don't use node.js so can't tell for sure, but it looks a good place to start.
can you check if the path of the handler and location of the index file in the packaged code is same? You will get this error when the path of the handler and the location of index.js in the package is not the same.
I notice documentation always says "index.js" but you mentioned "Index.js". I have no idea if it's relevant but just in case ...
I think you packaged a zip file which does not contains the index.js in root of zip
The zip commands can give you a zip file containing another folder inside which contains the index js
Try to verify the content of package
I replaced Index.js as follows:
exports.handler = function (event, context, callback) { . . .
but I got same error on cloudwatch.
2022-07-15T02:04:22.891Z undefined ERROR Uncaught Exception { "errorType": "Runtime.HandlerNotFound", "errorMessage": "index.handler is undefined or not exported", "stack": [ "Runtime.HandlerNotFound: index.handler is undefined or not exported", " at Object.module.exports.load (/var/runtime/UserFunction.js:283:11)", " at Object.<anonymous> (/var/runtime/index.js:43:34)", " at Module._compile (internal/modules/cjs/loader.js:1085:14)", " at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)", " at Module.load (internal/modules/cjs/loader.js:950:32)", " at Function.Module._load (internal/modules/cjs/loader.js:790:12)", " at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:75:12)", " at internal/main/run_main_module.js:17:47" ] }
Relevant questions
Problem starting Docker image as lambda function source
asked 2 years agoLambda Function Error
Accepted Answerasked a month agoV2 Lex Order Flowers Lambda error
asked 3 months agoLambda error code
asked 2 years agoMax number of SQS as triggers for a single lambda?
Accepted Answerasked 3 years agoHow divide Log Group by each Lambda function alias?
asked 2 years ago"Error - ENOENT" while creating a lambda function via cdk
asked 22 days agoLambda function as image, how to find your handler URI
asked 3 months agoHandler error when connecting lambda function to RDS database
asked 5 months agoCustom hosts file on Lambda image
asked 2 months ago
Thanks. It's was typo.