serverless-application-model: Getting error when enabling logs on stage of API Gateway using SAM

Description: Getting error when enabling logs on stage of API Gateway using SAM

Steps to reproduce the issue:

  1. Create sam template with below content and deploy
     Type: AWS::Serverless::Api
     Properties:
        StageName: prod
        MethodSettings:
          - ResourcePath: /
          - HttpMethod: GET
          - LoggingLevel: 'INFO'
          - MetricsEnabled: 'true'
          - DataTraceEnabled: 'true'
        DefinitionUri: "swagger.yaml"```

**Observed result:**
Getting error
`Invalid method setting path: null/null/logging/dataTrace. Must be one of: [/deploymentId, /description, /cacheClusterEnabled, /cacheClusterSize, /clientCertificateId, /accessLogSettings, /accessLogSettings/destinationArn, /accessLogSettings/format, /{resourcePath}/{httpMethod}/metrics/enabled, /{resourcePath}/{httpMethod}/logging/dataTrace, /{resourcePath}/{httpMethod}/logging/loglevel, /{resourcePath}/{httpMethod}/throttling/burstLimit/{resourcePath}/{httpMethod}/throttling/rateLimit/{resourcePath}/{httpMethod}/caching/ttlInSeconds, /{resourcePath}/{httpMethod}/caching/enabled, /{resourcePath}/{httpMethod}/caching/dataEncrypted, /{resourcePath}/{httpMethod}/caching/requireAuthorizationForCacheControl, /{resourcePath}/{httpMethod}/caching/unauthorizedCacheControlHeaderStrategy, /*/*/metrics/enabled, /*/*/logging/dataTrace, /*/*/logging/loglevel, /*/*/throttling/burstLimit /*/*/throttling/rateLimit /*/*/caching/ttlInSeconds, /*/*/caching/enabled, /*/*/caching/dataEncrypted, /*/*/caching/requireAuthorizationFor`

**Expected result:**

Log options are enabled in the stage specified

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 16 (8 by maintainers)

Most upvoted comments

Line 20-33 in above link gave error with yaml. I was able to convert to below format to get it working

MethodSettings:
  - LoggingLevel: INFO
    MetricsEnabled: true
    DataTraceEnabled: true
    ResourcePath: /*
    HttpMethod: '*'
`