我有一个index.js,并且定义了处理程序函数。但是当我测试的时候,我得到了错误index.handler is undefined or not exported
。你知道怎么解决这个问题吗?
{
"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"
]
}
Function Logs
START RequestId: fa81b4c8-23f6-4f15-899b-dfc680ae9c57 Version: $LATEST
2021-10-29T08:47:21.477Z 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: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"]}
2021-10-29T08:47:22.789Z 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: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"]}
END RequestId: fa81b4c8-23f6-4f15-899b-dfc680ae9c57
REPORT RequestId: fa81b4c8-23f6-4f15-899b-dfc680ae9c57 Duration: 1463.33 ms Billed Duration: 1464 ms Memory Size: 128 MB Max Memory Used: 11 MB
Unknown application error occurred
Runtime.HandlerNotFound
Request ID
fa81b4c8-23f6-4f15-899b-dfc680ae9c57
发布于 2021-10-29 04:36:09
Lambda函数还不支持ES6风格(https://docs.aws.amazon.com/lambda/latest/dg/nodejs-handler.html)
您应该使用:
exports.handler = async function(event, context) {
}
https://stackoverflow.com/questions/69768875
复制相似问题