相关疑难解决方法(0)

AWS Lambda函数返回模块'index'上缺少Handler'handler'

考虑以下代码 -

function index(event, context, callback) {
  //some code
}
exports.handler = index();

{
  "errorMessage": "Handler 'handler' missing on module 'index'"
}
Run Code Online (Sandbox Code Playgroud)

这是我的功能,它具有业务逻辑.我的javascript文件名是index.js.

每当我在aws lambda上测试这段代码时,它会给出以下内容log(failed).

这是亚马逊Lambda上传网站的屏幕截图: 在此输入图像描述

node.js aws-lambda

27
推荐指数
2
解决办法
3万
查看次数

AWS Lambda中缺少处理程序错误

我对基本问题表示歉意。我对AWS和Python都是全新的。我正在尝试执行https://boto3.readthedocs.io/en/latest/guide/migrations3.html#accessing-a-bucket中给出的示例代码,但遇到错误。

import botocore
import boto3
s3 = boto3.resource('s3')
bucket = s3.Bucket('bucketname')
exists = True


try:
    s3.meta.client.head_bucket(Bucket='bucketname')
except botocore.exceptions.ClientError as e:
    # If a client error is thrown, then check that it was a 404 error.
    # If it was a 404 error, then the bucket does not exist.
    error_code = int(e.response['Error']['Code'])
    if error_code == 404:
        exists = False 
Run Code Online (Sandbox Code Playgroud)

日志中的错误是

“ errorMessage”:“模块'lambda_function'上缺少处理程序'lambda_handler'”

python amazon-web-services aws-lambda

5
推荐指数
2
解决办法
8849
查看次数

标签 统计

aws-lambda ×2

amazon-web-services ×1

node.js ×1

python ×1