gpt4 book ai didi

aws-lambda - 使用 ApiGatewayV2 时无服务器框架抛出 "Execution logs are not supported on protocolType http"

转载 作者:行者123 更新时间:2023-12-03 07:27:26 26 4
gpt4 key购买 nike

我正在尝试创建一个 http 端点来触发我的 lambda 函数(并可能稍后与消防水带集成)。在我的 serverless.yml 中,我通过将其设置为关闭来关闭 ApiGatewayV2 的执行日志

    Stage:
Type: AWS::ApiGatewayV2::Stage
Properties:
ApiId:
Ref: Api
DeploymentId:
Ref: Deployment
StageName: v1
DefaultRouteSettings:
LoggingLevel: OFF
DataTraceEnabled: true

此外,我还尝试过为它触发的 lambda 函数打开执行日志记录,如下所示

functions:
StreamFunction:
memorySize: 128
runtime: rust
handler: hello
role: StreamRole
logs:
executionLogging: false
fullExecutionData: false

但我不断收到以下错误:“protocolType http 不支持执行日志”这是一个错误还是有任何其他地方我必须显式关闭日志

最佳答案

DataTraceEnabled 仅支持 WebSocket API。请参阅https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigatewayv2-stage-routesettings.html 。由于您提到您要创建的 API 是 HTTP 端点,因此设置 DataTraceEnabled: false 或从模板中删除 DataTraceEnabled 选项应该可以修复此错误。

关于aws-lambda - 使用 ApiGatewayV2 时无服务器框架抛出 "Execution logs are not supported on protocolType http",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62635178/

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