Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
mh1622 opened this issue Feb 16, 2022 · 3 comments · Fixed by #19023
Closed

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

mh1622 opened this issue Feb 16, 2022 · 3 comments · Fixed by #19023
Labels
@aws-cdk/aws-apigateway Related to Amazon API Gateway bug This issue is a bug. effort/small Small work item – less than a day of effort good first issue Related to contributions. See CONTRIBUTING.md p1

Comments

@mh1622
Copy link

mh1622 commented Feb 16, 2022

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.

@mh1622 mh1622 added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Feb 16, 2022
@github-actions github-actions bot added the @aws-cdk/aws-apigateway Related to Amazon API Gateway label Feb 16, 2022
@peterwoodworth
Copy link
Contributor

@peterwoodworth peterwoodworth added effort/small Small work item – less than a day of effort p1 and removed needs-triage This issue or PR still needs to be triaged. labels Feb 16, 2022
@peterwoodworth
Copy link
Contributor

Also, you can override the synthesized template with escape hatches

@peterwoodworth peterwoodworth added the good first issue Related to contributions. See CONTRIBUTING.md label Feb 16, 2022
@mergify mergify bot closed this as completed in #19023 Feb 24, 2022
mergify bot pushed a commit that referenced this issue Feb 24, 2022
API Gateway allows decimals and integers for rate limits. This PR fixes an error thrown when entering a decimal.

To fix this, I created a new method `validateDouble()` in `utils.ts` based off `validateInteger()` and updated the caller as seen in the commit.

This also fixes #18994.

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-apigateway Related to Amazon API Gateway bug This issue is a bug. effort/small Small work item – less than a day of effort good first issue Related to contributions. See CONTRIBUTING.md p1
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants