DianaIonita / serverless-api-gateway-throttling

A plugin for the Serverless framework which configures throttling for API Gateway endpoints.
ISC License
69 stars 7 forks source link

Per method throttling config is not being deleted on redeployment #5

Closed lkolchin closed 3 years ago

lkolchin commented 4 years ago

Hi,

I've deployed the config per method and verified that it was deployed. But when I removed it from serverless.yaml and left Throttling config as a Global setting - The per method config was not deleted on redeployment.

Before:

custom:
  serverless-jetpack:
    mode: npm # (default `yarn`)
  # Configures throttling settings for all http endpoints
  apiGatewayThrottling:
    maxRequestsPerSecond: 1000
    maxConcurrentRequests: 500

  landingPage1:
    role: landingPageRole
    handler: src/handler1.landingPage
    package:
      exclude:
        - "**/**"
      include:
        - src/handler1.js
    events:
      - http:
          path: 'landingPage1'
          method: get
          cors: true
          throttling:
            maxRequestsPerSecond: 2000
            maxConcurrentRequests: 1000
    environment:
      BG_COLOUR: ${self:custom.backgroundColour.${self:provider.stage}} 

After:

custom:
  serverless-jetpack:
    mode: npm # (default `yarn`)
  # Configures throttling settings for all http endpoints
  apiGatewayThrottling:
    maxRequestsPerSecond: 1000
    maxConcurrentRequests: 500

  landingPage1:
    role: landingPageRole
    handler: src/handler1.landingPage
    package:
      exclude:
        - "**/**"
      include:
        - src/handler1.js
    events:
      - http:
          path: 'landingPage1'
          method: get
          cors: true
    environment:
      BG_COLOUR: ${self:custom.backgroundColour.${self:provider.stage}} 
DianaIonita commented 4 years ago

Hi @lkolchin,

Thanks for flagging this, it's indeed an issue. I'm having some trouble getting throttling settings to be inherited from the stage again, hopefully someone might be able to help.

scadu commented 3 years ago

Hi,

I wonder if we could set -1 as default for the method throttling settings instead of trying to remove it? I see that's how it's done in AWS Terraform provider:

"throttling_burst_limit": {
    Type:     schema.TypeInt,
    Optional: true,
    Default:  -1,
},
"throttling_rate_limit": {
    Type:     schema.TypeFloat,
    Optional: true,
    Default:  -1,
},

Seems that the AWS provider has been fixed not that long time ago.

DianaIonita commented 3 years ago

Should now be fixed in v1.1.0.