Search code examples
aws-lambdaaws-cloudformationaws-api-gatewayserverless-frameworkaws-serverless

serverless framework throws "Execution logs are not supported on protocolType http" when using ApiGatewayV2


I am trying to create a http end point to trigger my lambda function (and potentially later integrate with fire hose). In my serverless.yml I have turned execution logs off for my ApiGatewayV2 by turning setting it to off as such

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

and additionally I have also tried turning of execution logging for the lambda function it triggers like this

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

but I keep getting the following error: 'Execution logs are not supported on protocolType http' is this a bug or are there any additional places I have to explicitly turn logs off


Solution

  • DataTraceEnabled is only supported for WebSocket APIs. See https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigatewayv2-stage-routesettings.html. Since you mention the API you are creating is an HTTP endpoint, setting DataTraceEnabled: false or removing the DataTraceEnabled option from your template should fix this error.