Skip to content

(aws-apigateway): cannot set usage plan throttle rate limit to decimal value #18994

@mh1622

Description

@mh1622

What is the problem?

When attempting to set an API Gateway (v1) usage plan throttling rate limit to a double (i.e. decimal value) I receive an error stating that the value should be an integer. This restriction is not present in the AWS Console, and is contradicted by the AWS CLI documentation: https://docs.aws.amazon.com/cli/latest/reference/apigateway/create-usage-plan.html

rateLimit -> (double)

Reproduction Steps

api.addUsagePlan("usage-plan", {
    throttle: {
      rateLimit: 0.033, // requests per second (1 request every 30 seconds)
      burstLimit: 1,
    }
  });

What did you expect to happen?

cdk synth should not throw any errors.

What actually happened?

cdk synth throws: Throttle rate limit should be an integer

CDK CLI Version

1.144.0

Framework Version

No response

Node.js Version

16.13.2

OS

Ubuntu 20.04

Language

Typescript

Language Version

No response

Other information

Bug appears to occur on this line of code: https://github.com/aws/aws-cdk/blob/master/packages/%40aws-cdk/aws-apigateway/lib/usage-plan.ts#L319

Removing the integer validation of rate limit would seem to be the correct fix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/aws-apigatewayRelated to Amazon API GatewaybugThis issue is a bug.effort/smallSmall work item – less than a day of effortgood first issueRelated to contributions. See CONTRIBUTING.mdp1

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions