serverless-aws-alias: Invalid method setting path

Add the plugin in my exist serverless.yml

plugins:
  - serverless-aws-alias

provider:
  name: aws
  runtime: nodejs6.10
  aliasStage:
    loggingLevel: "INFO"
    dataTraceEnabled: true

But got below error , when deploy:


Serverless: Checking Stack update progress...
........^@...................
Serverless: Operation failed!

  Serverless Error ---------------------------------------

  An error occurred: ApiGatewayStage - Invalid method setting path: /profile/ANY/logging/loglevel. Must be one of: [/deploymentId, /description, /cacheClusterEnabled, /cacheClusterSize, /clientCertificateId, /accesslogging, /accesslogging/destination, /accesslogging/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/requireAuthorizationForCa.

  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Forums:        forum.serverless.com
     Chat:          gitter.im/serverless/serverless

  Your Environment Information -----------------------------
     OS:                     linux
     Node Version:           6.11.3
     Serverless Version:     1.24.1

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 19 (11 by maintainers)

Most upvoted comments

Released with 1.5.1

Just use "serverless-aws-alias": "github:HyperBrain/serverless-aws-alias#support-any-in-stage-config" in your package.json. It will then install the branch directly from GitHub.

@ozbillwang You have to create a role as mentioned here: https://aws.amazon.com/premiumsupport/knowledge-center/api-gateway-cloudwatch-logs/ with the AmazonAPIGatewayPushToCloudWatchLogs policy attached.

And then in the API Gateway console at the bottom there is “Settings”. Enter the role you created and it should work. The role configuration in API Gateway is an account setting and applies to all APIs. This will enable the general use of the API logging and afterwards the deploy should go through.

If there is already a role assigned to API Gateway, you should look that up in IAM and just add the missing policy.

@ozbillwang Thanks for the report.

This might be an issue with the ANY method for endpoint proxies supporting any HTTP method. All other parts of the settings path /profile/ANY/logging/loglevel match the pattern /{resourcePath}/{httpMethod}/logging/loglevel mentioned in the error text.

Maybe AWS expects that the plugin translates ANY to the complete set of allowed methods that are covered by ANY.

Can you do a double check and specify the setting on function level, for just a function that does not have ANY endpoints and see if it then works? If yes, the ANY support has to be fixed in the plugin.