Mayank
Mayank

Reputation: 345

"Unable to parse API definition because of a malformed integration at path /price. (Service: AmazonApiGateway; Status Code: 400;

The following code I put for x-amazon-apigateway-integration, please let me know if I am missing something. Thanks

  x-amazon-apigateway-integration:
    httpMethod: post
    type: aws
    uri:
      Fn::Sub: 
        - arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${FunctionArn}/invocations      
        - { FunctionArn: !GetAtt  PriceAPIFunction.Arn}
    responses:
      default:
        statusCode: '200'

Upvotes: 4

Views: 4027

Answers (2)

DHEERAJ
DHEERAJ

Reputation: 611

Hi Mayank, Andreas

I was trying to create the CFT Deployment for the API and was getting the same error as Unable to parse API definition because of a malformed integration at path /.

I just figured out the solution as creating a AWS::Serverless-2016-10-31 Template for the deployment.

You must write the CloudFormation Template as :-

1. Add definition Transform: AWS::Serverless-2016-10-31 in the beginning of the Template.
2. For the API Definition, must refer the OpenApi as DefinitionBody: with the Transform function, which will modulate the YAML accordingly.

Type: AWS::Serverless::Api
    Properties:
      Name: !Sub "MyRestAPI"    
      StageName: !Sub "dev"
      DefinitionBody:
        "Fn::Transform":
          Name: "AWS::Include"
          Parameters:
            Location: !Sub "s3://${TemporaryBucket}/openapi.yaml"

Upvotes: 2

Andreas
Andreas

Reputation: 499

The ${AWS::Region} substitution is not supported - only the function name can be substituted. see https://github.com/awslabs/serverless-application-model/issues/79

Upvotes: 5

Related Questions