No integration defined for method - Choose a stage where your API will be deployed
I talked with customer service center of AWS. The problem was:
In this API there was an unintegrated method. Suppose there are a resource image
and I create a POST
method for this resource. But I forgot to integrate it to any AWS Lambda Function or HTTP. So the API cannot be deployed.
If the method is unnecessary then delete the method. OR you can integrate it as Mock
endpoint. You can change this endpoint anytime.
Note: For this unintegration problem AWS gives this type of wrong error message. They should update their message to save developer's time.
I was getting same error but when creating API using CloudFormation.
It turned out that in my AWS::ApiGateway::Deployment
resource, I needed to include DependsOn
attribute that "depends" on all my API methods.
For example, when building API with two AWS::ApiGateway::Method
resources, AWS::ApiGateway::Deployment
needs to depend on both these methods:
MyFirstApiMethod:
Type: AWS::ApiGateway::Method
Properties:
<your properties>
MySecondApiMethod:
Type: AWS::ApiGateway::Method
Properties:
<your properties>
MyDeployment:
Type: AWS::ApiGateway::Deployment
DependsOn: [MyFirstApiMethod, MySecondApiMethod] # <-- REQUIRED
Properties:
RestApiId: !Ref MyRestApi
Without the DependOn
attribute on all the API methods, CloudFormation may be
creating them after the deployment resource, resulting in No integration defined for method
error.