DianaIonita / serverless-api-gateway-throttling

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

Serverless throws error when throttling limit sets for endpoint #2

Closed NitroCat closed 4 years ago

NitroCat commented 4 years ago

Hello, I've installed and configured serverless-api-gateway-throttling in serverless.yaml as follows:

service: some-service-name
#...
custom:
#...
   stage: "some-stage"
   apiGatewayCaching:
      enabled: true
   apiGatewayThrottling:
      maxRequestsPerSecond: 50
      maxConcurrentRequests: 50
#...
functions:
#...
  health-check:
     role: someHealthCheckRole
     handler: src/handlers/health-check/handler.handler
     events:
       - http:
           path: /v1/health-check
           method: GET
           throttling:
             maxRequestsPerSecond: 2
             maxConcurrentRequests: 2
#...
resources:
  Resources:
    ApiGatewayRestApi:
      Type: AWS::ApiGateway::RestApi
      Properties:
        Name: ${self:service}-${self:custom.stage}
#...

execute:

sls deploy --stage some-stage

Actual result: Serverless throws:

Serverless Error ---------------------------------------

Function "some-service-name-some-stage-health-check" doesn't exist in this Service

Expected result Everything deployed successfully and throttling configuration applies to endpoint

After debugging looks like:

Node.js: v10.15.3 Serverless: v1.54.0

It's very usefull serverless plugin and I hope bug will be fixed =)

DianaIonita commented 4 years ago

Hey @NitroCat

Thanks for reporting this! The customFunctionName was originally introduced to support the custom name you can give a lambda when it's deployed: image

However it looks like it's not required at all, so I removed it and created a release which hopefully fixes your problem. Feel free to reopen this issue if not.