Skip to content

Deploying API Gateway through Amplify custom resource results in error: "REST API doesn't contain any methods ..." #5913

@livioschlaepfer

Description

@livioschlaepfer

Description

Amplify fails to deploy custom resource that contains a custom API Gateway with the following error:

(AWS::ApiGateway::Deployment), Event Type: create, Reason: Resource handler returned message: "The REST API doesn't contain any methods (Service: ApiGateway, Status Code: 400, Request ID: ...

Categories

  • Analytics
  • API (REST)
  • API (GraphQL)
  • Auth
  • Authenticator
  • DataStore
  • Notifications (Push)
  • Storage

Steps to Reproduce

  1. Create custom resource using 'amplify add custom' and selecting 'AWS CDK'
  2. Define RestApi using AWS CDK
  3. Deploy custom resource to trigger error

CDK stack snippet:

const animalsAuthorizer = new TokenAuthorizer(this, 'AnimalsApiRestAuthorizer', {
  handler: animalsAuthorizerFn,
});

const animalsApi = new RestApi(this, 'AnimalsRestApi', {
  restApiName: 'animals-rest-api-service',
});


const animals = animalsApi.root.addResource('animals');

// GET /animals
animals.addMethod('GET', new LambdaIntegration(animalsFn), {
  authorizer: animalsAuthorizer,
  authorizationType: AuthorizationType.CUSTOM,
});

// POST /animals
animals.addMethod('POST', new LambdaIntegration(animalsFn), {
  authorizer: animalsAuthorizer,
  authorizationType: AuthorizationType.CUSTOM,
});

Screenshots

No response

Platforms

  • iOS
  • Android
  • Web
  • macOS
  • Windows
  • Linux

Flutter Version

3.22.2

Amplify Flutter Version

2.30

Deployment Method

Amplify CLI (Gen 1)

Schema

Metadata

Metadata

Assignees

Labels

REST APIIssues related to the API (REST) CategoryquestionA question about the Amplify Flutter librariesto-be-reproducedIssues that have not been reproduced yet, but have reproduction steps provided

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions