AWS Lambda Python:模块上缺少“处理程序" [英] AWS Lambda Python: 'handler' missing on module

查看:286
本文介绍了AWS Lambda Python:模块上缺少“处理程序"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我具有以下结构的部署软件包:

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.

没有lambda_function?

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.

  1. http://qiita.com/kazuqqfp/items/ac8d93918d0030b31aad
  2. AWS Lambda函数正在返回处理程序'处理程序"在模块索引"上缺失
  1. http://qiita.com/kazuqqfp/items/ac8d93918d0030b31aad
  2. AWS Lambda Function is returning Handler 'handler' missing on module 'index'

这篇关于AWS Lambda Python:模块上缺少“处理程序"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆