Skip to content
Latchkey

AWS API Gateway "No integration defined for method" in CI

aws apigateway create-deployment failed because a method (a resource plus HTTP verb) has no integration attached. API Gateway will not deploy a stage that has a method routing nowhere.

What this error means

aws apigateway create-deployment fails with "BadRequestException: No integration defined for method" naming the method that is missing a backend.

aws
An error occurred (BadRequestException) when calling the CreateDeployment operation:
No integration defined for method

Common causes

A method was created without an integration

put-method ran but put-integration did not, so the GET/POST has no backend and the deploy is rejected.

A partial CLI script left a method orphaned

A multi-step build script created the method but failed or skipped the integration step, leaving the method incomplete.

How to fix it

Attach an integration to the method

  1. Identify the resource id and HTTP method the error names.
  2. Add the integration (Lambda proxy, HTTP, or MOCK) for that method.
  3. Re-run create-deployment once every method has a backend.
Terminal
aws apigateway put-integration \
  --rest-api-id $API_ID --resource-id $RES_ID \
  --http-method GET --type MOCK \
  --request-templates '{"application/json":"{\"statusCode\":200}"}'

Define the integration in the OpenAPI import

When importing OpenAPI, every method needs an x-amazon-apigateway-integration block so no method ships without a backend.

openapi.yaml
x-amazon-apigateway-integration:
  type: aws_proxy
  httpMethod: POST
  uri: arn:aws:apigateway:...:lambda:path/...

How to prevent it

  • Pair every put-method with a put-integration in build scripts.
  • Prefer OpenAPI import so integrations are declared with each method.
  • Run get-resources to confirm no method is left without an integration.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →