gpt4 book ai didi

amazon-web-services - 如何在cloudformation上配置 `TracingConfig`?

转载 作者:行者123 更新时间:2023-12-02 19:59:15 26 4
gpt4 key购买 nike

我想为我的 lambda 函数启用 x-ray,下面是模板文件:

Resources:
HelloWorldFunction:
Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction
Properties:
CodeUri: hello-world/
Handler: app.lambdaHandler
Runtime: nodejs8.10
TracingConfig:
Mode: Active
Events:
HelloWorld:
Type: Api # More info about API Event Source: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api
Properties:
Path: /hello
Method: post

通过 sam deploy 命令部署时出现以下错误:

Failed to create the changeset: Waiter ChangeSetCreateComplete failed: Waiter encountered a terminal failure state Status: FAILED. Reason: Transform AWS::Serverless-2016-10-31 failed with: Invalid Serverless Application Specification document. Number of errors found: 1. Resource with id [HelloWorldFunction] is invalid. property TracingConfig not defined for resource of type AWS::Serverless::Function

它显示 TracingConfig 未定义。为我的 lambda 配置它的正确方法是什么?

最佳答案

基于此docs ,它应该只是Tracing。所以正确的应该如下

Resources:
HelloWorldFunction:
Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction
Properties:
CodeUri: hello-world/
Handler: app.lambdaHandler
Runtime: nodejs8.10
Tracing: Active
Events:
HelloWorld:
Type: Api # More info about API Event Source: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api
Properties:
Path: /hello
Method: post

关于amazon-web-services - 如何在cloudformation上配置 `TracingConfig`?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56250893/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com