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 回答
1
已接受的回答

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
专家
已回答 9 个月前
profile pictureAWS
专家
已审核 9 个月前
  • Thank You for the Help

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则