AWS Lambda function in Step function returns "Runtime.HandlerNotFound"

211 views Asked by At

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.

1

There are 1 answers

1
Moein Moeinnia On

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