serverless-apigateway-service-proxy icon indicating copy to clipboard operation
serverless-apigateway-service-proxy copied to clipboard

VarOptions is messed up when a proxy and serverless http event have same path but different methods

Open gorj-tessella opened this issue 3 years ago • 0 comments

I have an api where a particular path has GET, DELETE, and PUT methods attached. GET and DELETE are handled via serverless-apigateway-service-proxy, but PUT needs to be run through a regular http event (lambda). CORS is enabled. I found that the PUT request was blocked by cors, and when digging into cloudformation-update-template-stack.json found that:

  • "ApiGatewayMethodApiXXXVarOptions" was in ApiGatewayDeploymentXXX.DependsOn twice, unlike any other entry
  • But there was only one ApiGatewayMethodApiXXXVarOptions entry
  • That entry lacked the PUT option

I believe that both serverless-apigateway-service-proxy and regular serverless are trying to generate the ApiGatewayMethodApiXXXVarOptions entry, and one is essentially overwriting the other.

gorj-tessella avatar Dec 08 '21 03:12 gorj-tessella