1

Problem: When I try to run a Step Function (with Lambda functions) I am given this error message:

Runtime.HandlerNotFound in step: SolarEdgeOvervie

Cause >

{
  "errorType": "Runtime.HandlerNotFound",
  "errorMessage": "index.handler is undefined or not exported",
  "trace": [
    "Runtime.HandlerNotFound: index.handler is undefined or not exported",
    "    at Object.module.exports.load (/var/runtime/UserFunction.js:144:11)",
    "    at Object.<anonymous> (/var/runtime/index.js:43:30)",
    "    at Module._compile (internal/modules/cjs/loader.js:999:30)",
    "    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)",
    "    at Module.load (internal/modules/cjs/loader.js:863:32)",
    "    at Function.Module._load (internal/modules/cjs/loader.js:708:14)",
    "    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)",
    "    at internal/main/run_main_module.js:17:47"
  ]
}

// Task failed by SolarEdgeOverview 

{
  "resourceType": "lambda",
  "resource": "invoke",
  "error": "Runtime.HandlerNotFound",
  "cause": {
    "errorType": "Runtime.HandlerNotFound",
    "errorMessage": "index.handler is undefined or not exported",
    "trace": [
      "Runtime.HandlerNotFound: index.handler is undefined or not exported",
      "    at Object.module.exports.load (/var/runtime/UserFunction.js:144:11)",
      "    at Object.<anonymous> (/var/runtime/index.js:43:30)",
      "    at Module._compile (internal/modules/cjs/loader.js:999:30)",
      "    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)",
      "    at Module.load (internal/modules/cjs/loader.js:863:32)",
      "    at Function.Module._load (internal/modules/cjs/loader.js:708:14)",
      "    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)",
      "    at internal/main/run_main_module.js:17:47"
    ]
  }
}

// Excution failed

{
  "error": "Runtime.HandlerNotFound",
  "cause": {
    "errorType": "Runtime.HandlerNotFound",
    "errorMessage": "index.handler is undefined or not exported",
    "trace": [
      "Runtime.HandlerNotFound: index.handler is undefined or not exported",
      "    at Object.module.exports.load (/var/runtime/UserFunction.js:144:11)",
      "    at Object.<anonymous> (/var/runtime/index.js:43:30)",
      "    at Module._compile (internal/modules/cjs/loader.js:999:30)",
      "    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)",
      "    at Module.load (internal/modules/cjs/loader.js:863:32)",
      "    at Function.Module._load (internal/modules/cjs/loader.js:708:14)",
      "    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)",
      "    at internal/main/run_main_module.js:17:47"
    ]
  }
}

I have used a default setup, I think.

I suspect that I haven’t set up the Step-Function correctly or when I did some research into the error I might not have given sufficient permission to the “index.handler” or Zip etc.

fedonev
  • 20,327
  • 2
  • 25
  • 34
  • Do you have index.js file in the root folder for each lambda functions? https://stackoverflow.com/questions/60665901/index-handler-is-undefined-or-not-exported – Arpit Jain Jan 07 '23 at 18:29
  • 1
    Welcome to SO! @ArpitJain had a good suggestion. Also, it's considered a good SO practice to add the first few lines of your Lambda function code to the question. Not a code dump, just the minimum. – fedonev Jan 07 '23 at 18:52
  • @ArpitJain How would I go around checking that, and if necessary fixing it as I can’t find how to do on the internet ? -Edit: Spelling –  Jan 08 '23 at 18:29
  • @Pilgrim, you can check in aws lambda console and select your function, and then there will be a `code` tab:- https://console.aws.amazon.com/lambda/home. You can read this page from aws to get the basic understanding on aws lamdas:- https://docs.aws.amazon.com/lambda/latest/dg/getting-started.html – Arpit Jain Jan 08 '23 at 18:38

1 Answers1

0

The best way to fix this problem for good is to use an automated tool like serverless and let the tool handle the folder structure and deployment for you. checkout this link

Moein Moeinnia
  • 1,945
  • 3
  • 10
  • 26
  • I would like to solve the problem at hand so that I can follow the tutorial and I have invested quite a bit of time into this. But if it comes to worse, I will try this method. –  Jan 08 '23 at 18:33