DianaIonita/serverless-api-gateway-caching

Invalid logging level specified: null on v1.10.0

cdubz opened this issue · 3 comments

cdubz commented

After upgrading from v1.9.0 to v1.10.0 I'm seeing an error Invalid logging level specified: null when attempting to deploy an application.

Here is what my serverless.yml file looks like.

service: [...]

plugins:
  - serverless-webpack
  - serverless-offline
  - serverless-domain-manager
  - serverless-api-gateway-caching
  - serverless-stack-termination-protection

provider:
  name: aws
  runtime: nodejs14.x
  region: us-west-2
  stage: dev
  logRetentionInDays: 30
  timeout: 10
  environment:
    [...]
  apiGateway:
    apiKeys:
      [...]
    shouldStartNameWithService: true

custom:
  stage: ${opt:stage, self:provider.stage}
  ssmPrefix: /${self:service}/${self:custom.stage}
  apiGatewayCaching:
    enabled: true
  customDomain:
    domainName: [...]
    certificateName: [...]
    basePath: "v1"
    stage: ${self:custom.stage}
    createRoute53Record: true
    autoDomain: true

functions:
  [...]

resources:
  Resources:
    [...]

I have tested updates to the other configured plugins individually and the issue does not occur. It only comes up when upgrading serverless-api-gateway-caching to v1.10.0.

It looks like this is caused by this change from #122. In my case none of my methods have a log level set (and I'm kind of unclear where in the YAML that setting would go?).

In theory a workaround would be to set custom.apiGatewayCaching.inheritCloudWatchSettingsFromStage to false though I have not tested that yet.

Hi @cdubz,

Thank you for reporting the issue! I was able to reproduce it and released a fix in v1.10.1.
Please let me know if you're still having trouble.

In my case none of my methods have a log level set (and I'm kind of unclear where in the YAML that setting would go?).

You can configure that at stage level using vanilla serverless (reference), for example:

provider:
  name: aws
  apiGateway:
    metrics: true
  logs:
   restApi:
     level: INFO
     accessLogging: true
     executionLogging: true
     fullExecutionData: true
cdubz commented

Tested and working. Thanks for the fix!

And thanks for the info re: where to configure this -- I was confused about where to add the default logging configuration when trying to troubleshoot.