64

I'm working with AWS API Gateway and AWS Lambda. Often I face this type of error message when attempt to deploy API. The error message says to select a deployment stage. But I still selecting and trying to deploy! but same error occur!

Screenshot of pop up error message

In this API I have multiple resources with multiple methods. Previously I succeed to deploy this same API with the same way. But now I can't deploy it.

Please anyone help me to fix it. For addition: I don't use AWS CLI tool, just use AWS web dashboard.

8 Answers 8

94

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.

6
  • 1
    thank you sir. To do so, I have to wait at least 2 days (as SO rules). :-) Sep 7, 2017 at 9:43
  • 2
    "No integration defined for method" seems cryptic at first, but I don't understand why you consider it to be wrong if, as described, it means you created a method without defining an integration for it. Sep 7, 2017 at 14:02
  • Sir, by mistake I added a method to my API a few days ago. When I add another resource and methods then I need to deploy. So the error occurred. If AWS gave me an error like "Unintegrated method found" it would be better to find the issue. Sep 7, 2017 at 14:07
  • 7
    > why you consider it to be wrong I consider it incomplete. The message should be something like "Resource POST /image defined without endpoint handler", somehow pointing out WHICH method is referred to.
    – fiddur
    Feb 20, 2019 at 15:30
  • 4
    Is there any way to find out which exact method is failing? I have an API Gateway with a 100 methods and I'm unable to find out which ones are giving issues. Mar 12, 2021 at 10:20
15

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.

2

If you have another resource which is not completed to configuration it will read as well. In short, if you haven't given them a lambda function, the api itself is not allowed to be deployed until you finish the rest.

2

I encountered the same error with deploying via Terraform. The reason was I defined an IAM role for my API and I didn't include the role resource to triggers when deploying the API. Just make sure all resources that are defined before deploying are included in triggers.

1
  • can you please explain a bit. I am having a same error with terraform.
    – Tayyab
    Aug 16 at 21:58
0

Just integrate Lambda function in every method you created.

1
  • Cool, it's work for me. I had forgotten to integrate a method... dammm
    – calraiden
    Jan 24, 2022 at 10:59
0

Make sure every resource and method is configured properly. Let's say your api-gateway is hierarchy is like:

/
   R1
    R2 
     M1 
     M2
    R3
     M3

so every resource(R1,R2,R3) and every method(M1,M2,M3) should be configured properly. enter image description here

0

I deployed using CDK with --no-rollback (this should work for any cloudformation though)

In my case, the API was created and I could inspect it in the AWS Console, and only the "AWS::ApiGateway::Deployment" failed to create. It turns out I had a bad value for service attribute (I was using StepFunctions, which was not working)

THEN I see that I have a dangling resouce/method that is broken - so my deployment was failing due to garbage in AWS, not my CDK/template.

0

In my case, I was deploying my CDK stack to the dev environment but I had made some changes to the API gateway on the AWS console, adding some resources and methods just for testing purposes

And that was conflicting with my CDK deployment, causing the API gateway error:

enter image description here

Once I deleted the resources that I had created on the console and deployed them again, it worked perfectly

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.