AWS Lambda Python:模块上缺少“处理程序" [英] AWS Lambda Python: 'handler' missing on module
问题描述
我具有以下结构的部署软件包:
I have a deployment package in the following structure:
my-project.zip
--- my-project.py
------ lambda_handler()
然后我在配置文件中定义处理程序路径
Then I define the handler path in configuration file
my-project.lambda_handler
my-project.lambda_handler
获取错误:
'handler' missing on module
不明白
推荐答案
此错误发生了一些问题.
There are some issues occurring this error.
您遇到的第一个问题是,如果您错误地命名文件,则会出现此错误:
The very first issue you’re gonna run into is if you name the file incorrectly, you get this error:
无法导入模块"lambda_function":没有名为lambda_function的模块
Unable to import module 'lambda_function': No module named lambda_function
如果函数名称不正确,则会出现此错误:
If you name the function incorrectly you get this error:
模块'lambda_function_file'上缺少处理程序'handler':'module' 对象没有属性处理程序"
Handler 'handler' missing on module 'lambda_function_file': 'module' object has no attribute 'handler'
在仪表板上,确保将处理程序字段输入为function_filename.actual_function_name
,并确保它们与您的部署包匹配.
On the dashboard, make sure the handler field is entered as function_filename.actual_function_name
and make sure they match up in your deployment package.
如果只是消息更具指导性,那将是一个更简单的步骤.
If only the messages were a bit more instructive that would have been a simpler step.
adrian_praja 解决了
adrian_praja has solved the issue in aws forum. He answered the following
我相信您的
index.js
应该包含
exports.createThumbnailHandler = function(event, context) {}
问题3:
解决方案:正确指定方法调用
Issue#3:
Solution: Correctly specify the method call
当在Lambda的设置中由node.js
调用的方法的规范不正确时,会发生这种情况.
请查看调用方法的规范.
This happens when the specification of the method called by node.js
is incorrect in Lambda's setting.
Please review the specification of the method to call.
在出现上述错误消息的情况下,我尝试调用index.js
的处理程序方法,但找不到相应的方法.
调用的处理通过配置选项卡上的处理程序"进行设置.
下面是设置调用index.js
的处理程序方法的示例.
In the case of the above error message, I attempted to call the handler method of index.js
, but the corresponding method could not be found.
The processing to call is set with "Handler" on the configuration tab.
Below is an example of setting to call the handler method of index.js
.
- http://qiita.com/kazuqqfp/items/ac8d93918d0030b31aad
- AWS Lambda Function is returning Handler 'handler' missing on module 'index'
这篇关于AWS Lambda Python:模块上缺少“处理程序"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!