Repository: serverless/serverless (JavaScript) — Bug Fix

Issue:
reservedConcurrency configuration is not persisting to the stack
# This is a Bug Report

## Description

A function's `reservedConcurrency` property is not being persisted to the CloudFormation template and therefore stack. See my function configuration below:

```yaml
functions:
  functionName:
    handler: bin/function-binary
    reservedConcurrency: 0
    events:
    - sqs: ${self:custom.sqsQueueArn}
```

There are no errors or anything, the property is just ignored. According to the docs, it should be a valid property: https://serverless.com/framework/docs/providers/aws/guide/functions/

For feature proposals:
N/A

Similar or dependent issues:
N/A

## Additional Data

* ***Serverless Framework Version you're using***: 1.32.0
* ***Operating System***: MacOS
* ***Stack Trace***: N/A
* ***Provider Error messages***: N/A



Discussion:
This just screwed up my production deploy... Where are the serverless maintainers... Is serverless being abandoned?

Resolving patch:
diff --git a/lib/plugins/aws/package/compile/functions/index.js b/lib/plugins/aws/package/compile/functions/index.js
index 3d662abb740..25f2ba72b64 100644
--- a/lib/plugins/aws/package/compile/functions/index.js
+++ b/lib/plugins/aws/package/compile/functions/index.js
@@ -298,7 +298,7 @@ class AwsCompileFunctions {
       delete newFunction.Properties.VpcConfig;
     }
 
-    if (functionObject.reservedConcurrency) {
+    if (functionObject.reservedConcurrency || functionObject.reservedConcurrency === 0) {
       if (_.isInteger(functionObject.reservedConcurrency)) {
         newFunction.Properties.ReservedConcurrentExecutions = functionObject.reservedConcurrency;
       } else {


Test patch:
diff --git a/lib/plugins/aws/package/compile/functions/index.test.js b/lib/plugins/aws/package/compile/functions/index.test.js
index 82bc858f202..4569c0195b7 100644
--- a/lib/plugins/aws/package/compile/functions/index.test.js
+++ b/lib/plugins/aws/package/compile/functions/index.test.js
@@ -1929,6 +1929,47 @@ describe('AwsCompileFunctions', () => {
         });
     });
 
+    it('should set function declared reserved concurrency limit even if it is zero', () => {
+      const s3Folder = awsCompileFunctions.serverless.service.package.artifactDirectoryName;
+      const s3FileName = awsCompileFunctions.serverless.service.package.artifact
+        .split(path.sep).pop();
+      awsCompileFunctions.serverless.service.functions = {
+        func: {
+          handler: 'func.function.handler',
+          name: 'new-service-dev-func',
+          reservedConcurrency: 0,
+        },
+      };
+      const compiledFunction = {
+        Type: 'AWS::Lambda::Function',
+        DependsOn: [
+          'FuncLogGroup',
+          'IamRoleLambdaExecution',
+        ],
+        Properties: {
+          Code: {
+            S3Key: `${s3Folder}/${s3FileName}`,
+            S3Bucket: { Ref: 'ServerlessDeploymentBucket' },
+          },
+          FunctionName: 'new-service-dev-func',
+          Handler: 'func.function.handler',
+          MemorySize: 1024,
+          ReservedConcurrentExecutions: 0,
+          Role: { 'Fn::GetAtt': ['IamRoleLambdaExecution', 'Arn'] },
+          Runtime: 'nodejs4.3',
+          Timeout: 6,
+        },
+      };
+
+      return expect(awsCompileFunctions.compileFunctions()).to.be.fulfilled
+        .then(() => {
+          expect(
+            awsCompileFunctions.serverless.service.provider.compiledCloudFormationTemplate
+              .Resources.FuncLambdaFunction
+          ).to.deep.equal(compiledFunction);
+        });
+    });
+
     it('should throw an informative error message if non-integer reserved concurrency limit set ' +
       'on function', () => {
       awsCompileFunctions.serverless.service.functions = {