Serverless.yml indentation issue using {proxy+} as path

aws

#1

Hello,

I’m deploying an asp.net core lambda application and using a path of {proxy+} to allow any type of call through via the api gateway. However, I’m having issues when trying to add the cors and authorizer options via the serverless.yml file.

Varient 1

    events:
      - http:
          path: {proxy+} 
          method: any
          authorizer: aws_iam
          cors: true

Set like this, I get the following exception: Missing or invalid “path” property in function “api” for http event in serverless.yml

Variant 2

    events:
      - http: ANY {proxy+} 
          authorizer: aws_iam
          cors: true

I get this error: bad indentation of a mapping entry in “C:\source\scv\ao.scv.clickstream\serverless.yml” at line 56, column 21:
authorizer: aws_iam

with an ^ pointing at the colon

If I set an actual path instead of {proxy+}, I do not see this error.

Any ideas?


#2

Sometimes a little more time is needed - almost immediately after posting this I tried prefixing the path with a /

    events:
      - http: 
          method: any
          path: /{proxy+}
          cors: true
          authorizer: aws_iam

This works.


#3

Where is this {proxy+} documented? This is exactly the solution I’m looking for, but I’ve been pouring over docs for a few nights and haven’t run across this anywhere.


#4

This is an AWS configuration. It isn’t specific to Serverless:

https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-set-up-simple-proxy.html