How do I resolve "Invalid mapping expression specified" errors from API Gateway?
"I used an AWS CloudFormation template—or OpenAPI definition—to create an Amazon API Gateway API with a proxy resource. When I try to add URL path parameters to the API, I get an "Invalid mapping expression specified" error message. How do I resolve the error?"
"I used an AWS CloudFormation template—or OpenAPI definition—to create an Amazon API Gateway API with a proxy resource. When I try to add URL path parameters to the API, I get an "Invalid mapping expression specified" error message. How do I resolve the error?Short descriptionAPI Gateway returns an Invalid mapping expression specified error when the proxy path parameter {proxy+} doesn't have a defined a URL path parameter mapping.To resolve the error, do the following:For an AWS CloudFormation template, define the RequestParameters property of the AWS::ApiGateway::Method section.For an OpenAPI definition, define the parameters section under the x-amazon-apigateway-any-method object.ResolutionFor CloudFormation templates1.    Update the CloudFormation template so that the RequestParameters value is set to true.Example CloudFormation template RequestParameters.....  ProxyMethod:    Type: 'AWS::ApiGateway::Method'    Properties:      .      .      RequestParameters:               method.request.path.proxy: true             Integration:        RequestParameters:          integration.request.path.proxy: 'method.request.path.proxy'               IntegrationHttpMethod: ANY        .        ....2.    Update your API by using the CloudFormation template to update the AWS CloudFormation stack.Note: For more information on how to update API Gateway resources, see Amazon API Gateway resource type reference.For OpenAPI definitions1.    Update your API definition so that the parameters under the x-amazon-apigateway-any-method section have the following values:      "x-amazon-apigateway-any-method": {                "parameters": [          {            "name": "proxy",            "in": "path",            "required": true,            "type": "string"          }        ]........}2.    Update your API by importing your updated API definition file into API Gateway.Note: For more information, see Describing parameters on the OpenAPI website.Test the setup1.    In the API Gateway console, choose the name of your API.2.    Add URL path parameters as needed for your use case. If your proxy path parameter includes a correctly defined a URL path parameter mapping, then no error appears.Related informationx-amazon-apigateway-integration.requestParameters objectSet up a proxy integration with a proxy resourceSetting up data transformations for REST APIsFollow"