Validation error ApiGatewayMethodProxyVarGet: expected type: Boolean, found: JSONObject in AWS CloudFormation

50 views Asked by At

I'm trying to deploy using serverless to lambda but its getting failed in cloudformation stack. enter image description here

below is the cloudformation template "ApiGatewayMethodProxyVarGet" part

"ApiGatewayMethodProxyVarGet": 
{
  "Type": "AWS::ApiGateway::Method",
  "Properties": {
    "HttpMethod": "GET",
    "RequestParameters": {},
    "ResourceId": {
      "Ref": "ApiGatewayResourceProxyVar"
    },
    "RestApiId": {
      "Ref": "ApiGatewayRestApi"
    },
    "ApiKeyRequired": false,
    "AuthorizationType": "NONE",
    "Integration": {
      "IntegrationHttpMethod": "POST",
      "Type": "AWS_PROXY",
      "Uri": {
        "Fn::Join": [
          "",
          [
            "arn:",
            {
              "Ref": "AWS::Partition"
            },
            ":apigateway:",
            {
              "Ref": "AWS::Region"
            },
            ":lambda:path/2015-03-31/functions/",
            {
              "Fn::GetAtt": [
                "HttpLambdaFunction",
                "Arn"
              ]
            },
            "/invocations"
          ]
        ]
      }
    },
    "MethodResponses": []
  },
  "DependsOn": [
    "HttpLambdaPermissionApiGateway"
  ]
}

Could someone throw me in the right direction, please?

Cheers!

1

There are 1 answers

0
Kevin On

Based on the template you sent something seems to be missing or you are running it through something like SAM which is changing some of the properties. The error points to your code having this:

"RequestParameters": {
  "method.request.path.proxy": { "Key": "Value"}
},

The schema for that resource defines the values as such:

"RequestParameters": {
   "additionalProperties": false,
   "patternProperties": {
    "[a-zA-Z0-9]+": {
     "type": [
      "boolean",
      "string"
     ]
    }
   },
   "type": "object"
  },

Which means that the value for that method.request.path.proxy should be a boolean. It also allows string as long as the value of that string is boolean "true"