Resource handler returned message: "The REST API doesn't contain any methods

0

Hello, I get this error from my Cloudformation when try to create a multiple deployment stages for my RestAPI.

Error OutPut:

Resource handler returned message: "The REST API doesn't contain any methods (Service: ApiGateway, Status Code: 400, Request ID: 0041fbd4-40b8-45f0-82ea-548ec54fc50c)" (RequestToken: fb35e5d7-1ee6-d3e0-8d05-1d7ec51e83bf, HandlerErrorCode: InvalidRequest)

Sample Template used

 APIProdDeployment:
    Type: AWS::ApiGateway::Deployment
    Properties:
      RestApiId: !Ref RestAPI

APITestDeployment:
    Type: AWS::ApiGateway::Deployment
    Properties:
      RestApiId: !Ref RestAPI

1 Answer
1
Accepted Answer

Hi,

you will need to add a dependency on the methods.

If you create an AWS::ApiGateway::RestApi resource and its methods (using AWS::ApiGateway::Method) in the same template as your deployment, the deployment must depend on the RestApi's methods. To create a dependency, add a DependsOn attribute to the deployment. If you don't, AWS CloudFormation creates the deployment right after it creates the RestApi resource that doesn't contain any methods, and AWS CloudFormation encounters the following error: The REST API doesn't contain any methods.

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-deployment.html

profile pictureAWS
EXPERT
answered 8 months ago
profile pictureAWS
EXPERT
reviewed 8 months ago
  • Thank You for the Help

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions

Relevant content