小编chp*_*sam的帖子

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
查看次数

标签 统计

amazon-web-services ×1

aws-lambda ×1

python ×1