Working with AWS API Gateway recently, I hit a roadblock when trying to deploy my API. The console kept throwing this error: "No integration defined for method"
- even though I was absolutely certain I had configured the integration properly. Here's what I discovered through painful trial and error.
Before diving deep, let's eliminate some basic mistakes:
- Make sure you've selected the right HTTP method (GET/POST/etc.) in your method setup
- Verify you've actually created the integration (not just the method)
- Check that the integration type matches your backend (Lambda/HTTP/Mock)
This is what a correct integration setup should look like in CloudFormation:
Resources:
ApiGatewayRestApi:
Type: AWS::ApiGateway::RestApi
Properties:
Name: MyDemoApi
ApiGatewayResource:
Type: AWS::ApiGateway::Resource
Properties:
RestApiId: !Ref ApiGatewayRestApi
ParentId: !GetAtt ApiGatewayRestApi.RootResourceId
PathPart: "items"
ApiGatewayMethod:
Type: AWS::ApiGateway::Method
Properties:
RestApiId: !Ref ApiGatewayRestApi
ResourceId: !Ref ApiGatewayResource
HttpMethod: GET
AuthorizationType: NONE
Integration:
Type: AWS_PROXY
IntegrationHttpMethod: POST
Uri: !Sub "arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${LambdaFunction.Arn}/invocations"
What finally solved it for me was realizing that API Gateway has two separate concepts:
- API Definition - Your resources, methods and integrations
- Stage Deployment - The actual published version of your API
Even if you've perfectly configured everything, you might still get this error if you're trying to deploy to a stage where previous deployment failed or is incomplete.
Here's my debugging checklist:
1. Go to API Gateway Console → Your API → Resources
2. Expand the resource and method giving you trouble
3. Click on "Integration Request"
4. Verify all required fields are populated:
- Integration type
- HTTP method (for HTTP integrations)
- Endpoint URL/Lambda ARN
5. If using Lambda, ensure you've granted API Gateway permission to invoke it
For CLI users, you can verify integrations with:
aws apigateway get-method \
--rest-api-id YOUR_API_ID \
--resource-id YOUR_RESOURCE_ID \
--http-method GET
If you're still stuck after checking everything, try this last-resort solution:
1. Create a brand new API Gateway
2. Recreate your resources and methods
3. Deploy to a new stage
Sometimes the API Gateway state gets corrupted, especially when making rapid changes through multiple interfaces (Console/CLI/CloudFormation). Starting fresh can surprisingly be the fastest solution.
When working with AWS API Gateway, the "No integration defined for method" error typically occurs during deployment, even when you've configured integration settings. This frustrating message appears when the API Gateway can't find a valid integration for one or more HTTP methods in your API.
Based on the screenshot and common scenarios, here's what might be happening:
- Incomplete integration configuration despite UI appearance
- Missing HTTP method mappings
- Deployment to a stage before completing integration setup
- IAM permission issues preventing proper configuration
Let's examine a complete integration setup using AWS CLI commands. This will help identify where your configuration might be lacking:
aws apigateway get-method \
--rest-api-id YOUR_API_ID \
--resource-id YOUR_RESOURCE_ID \
--http-method GET
The output should show a complete method configuration including integration details. If the integration section is missing or incomplete, that's your problem.
Here's a properly configured Lambda integration via CloudFormation template:
Resources:
ApiGatewayMethod:
Type: AWS::ApiGateway::Method
Properties:
AuthorizationType: NONE
HttpMethod: GET
Integration:
IntegrationHttpMethod: POST
Type: AWS_PROXY
Uri: !Sub "arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${LambdaFunction.Arn}/invocations"
ResourceId: !Ref ApiGatewayResource
RestApiId: !Ref ApiGateway
- Double-check the integration type - Ensure you've selected AWS Service, Lambda, HTTP, or Mock as appropriate
- Verify integration request settings - Even if you see the integration in the UI, the actual configuration might be incomplete
- Check stage deployments - Try creating a new deployment and stage after confirming all integrations
Here's a Python script using Boto3 to validate your API Gateway methods:
import boto3
def validate_api_integrations(api_id):
client = boto3.client('apigateway')
resources = client.get_resources(restApiId=api_id)['items']
for resource in resources:
for method in resource.get('resourceMethods', {}).keys():
response = client.get_method(
restApiId=api_id,
resourceId=resource['id'],
httpMethod=method
)
if 'methodIntegration' not in response:
print(f"Missing integration for {method} {resource['path']}")
validate_api_integrations('your-api-id-here')
When using the AWS Console:
- Always click "Save" after configuring integration - the UI doesn't always auto-save
- Refresh the page and verify changes persisted
- Check different tabs (Integration Request, Integration Response) for completeness