在我使用 boto3 和 arn 通过其他 lambda 调用它后,AWS Lambda s3 触发器停止工作

发布于 2025-01-17 12:59:31 字数 598 浏览 2 评论 0原文

我有一个AWS lambda函数,当我在S3存储桶中上传HTML时,它正在触发,并且效果很好。 然后,我对代码进行了一些更新,以便我也可以使用Boto3的client.invoke(pyhton3)调用另一个lambda,但是一旦我使用boto3调用了另一个lambda,它就停止了为S3工作。 (当我用boto3调用它时,它仍然可以正常工作)。

def lambda_handler(event, context):
    api_flag = False
    if 'api_call' in event and event['api_call'] is True:
        api_flag = True
        data = event
    else:
        #code if its triggered by s3. 
        print("Received event: " + json.dumps(event, indent=2))
        print("Received context: ", context)
    if api_flag is True:
        return{success:200}

我希望这两种方法都会触发它。

I have an aws lambda function which is being triggered when I upload a html in s3 bucket and it works fine.
Then I updated the code a little bit so I can invoke it by another lambda using boto3's client.invoke (pyhton3) as well but as soon as I invoked it by another lambda using boto3 it stops working for s3. (It still works fine when I invoke it with boto3).

def lambda_handler(event, context):
    api_flag = False
    if 'api_call' in event and event['api_call'] is True:
        api_flag = True
        data = event
    else:
        #code if its triggered by s3. 
        print("Received event: " + json.dumps(event, indent=2))
        print("Received context: ", context)
    if api_flag is True:
        return{success:200}

I expected it to be triggered by both methods.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文