But that doesn't work for me (I followed the guide for basic-starter-api-gateway-v1) - the Lambda invocation fails with
2021-02-12T08:22:17.961Z undefined ERROR Uncaught Exception
{
"errorType": "Runtime.HandlerNotFound",
"errorMessage": "main.handler is not a function",
"stack": [
"Runtime.HandlerNotFound: main.handler is not a function",
" at Object.module.exports.load (/var/runtime/UserFunction.js:150: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"
]
}
Looking at the return value of serverlessExpress(), it is an object where the handler is one of its keys. Thus, it works for me when changing the export to
Fixed. I forgot to run npm update in the examples to use the latest version of this package. You can either git pull the latest, or run npm update within the example directory you're using.
Hi,
The examples, e.g. basic-starter-api-gateway-v1 suggest to use code like
But that doesn't work for me (I followed the guide for basic-starter-api-gateway-v1) - the Lambda invocation fails with
Looking at the return value of
serverlessExpress()
, it is an object where the handler is one of its keys. Thus, it works for me when changing the export toAm I missing something here? Because I haven't seen this in any example.