Repository: localstack/localstack

Issue:
AWS Lambda - Create lambda function does not return function details
When creating a new lambda function using the CLI, the function is created, but the lambda details are not returned.

## Context

According to the [AWS Lambda API documentation](https://docs.aws.amazon.com/lambda/latest/dg/API_CreateFunction.html), creating a new lambda function will return the details of the function created.

## Process

1. Package the lambda into a zip archive.
2. Create a new lambda using AWS CLI command
`aws --endpoint-url=http://localhost:4574 --region=us-east-1 lambda create-function --function-name=myFunction --runtime=nodejs6.10 --role=arn:aws:iam:local --handler=lambda.handler --zip-file=fileb://lambda.zip`
3. The lambda function is created and the result printed on the screen.

## Expected result

```javascript
HTTP/1.1 201
Content-type: application/json

{
   "CodeSha256": "string",
   "CodeSize": number,
   "DeadLetterConfig": { 
      "TargetArn": "string"
   },
   "Description": "string",
   "Environment": { 
      "Error": { 
         "ErrorCode": "string",
         "Message": "string"
      },
      "Variables": { 
         "string" : "string" 
      }
   },
   "FunctionArn": "string",
   "FunctionName": "string",
   "Handler": "string",
   "KMSKeyArn": "string",
   "LastModified": "string",
   "MasterArn": "string",
   "MemorySize": number,
   "Role": "string",
   "Runtime": "string",
   "Timeout": number,
   "TracingConfig": { 
      "Mode": "string"
   },
   "Version": "string",
   "VpcConfig": { 
      "SecurityGroupIds": [ "string" ],
      "SubnetIds": [ "string" ],
      "VpcId": "string"
   }
}
```

## Current result

`{}`


Discussion:

Resolving patch:
diff --git a/localstack/services/awslambda/lambda_api.py b/localstack/services/awslambda/lambda_api.py
--- a/localstack/services/awslambda/lambda_api.py
+++ b/localstack/services/awslambda/lambda_api.py
@@ -473,6 +473,8 @@ def execute(event, context):
 
     add_function_mapping(lambda_name, lambda_handler, lambda_cwd)
 
+    return {'FunctionName': lambda_name}
+
 
 def do_list_functions():
     funcs = []
@@ -515,7 +517,21 @@ def create_function():
         lambda_arn_to_runtime[arn] = data['Runtime']
         lambda_arn_to_envvars[arn] = data.get('Environment', {}).get('Variables', {})
         result = set_function_code(data['Code'], lambda_name)
-        return result or jsonify({})
+        result.update({
+            "DeadLetterConfig": data.get('DeadLetterConfig'),
+            "Description": data.get('Description'),
+            "Environment": {"Error": {}, "Variables": lambda_arn_to_envvars[arn]},
+            "FunctionArn": arn,
+            "FunctionName": lambda_name,
+            "Handler": lambda_arn_to_handler[arn],
+            "MemorySize": data.get('MemorySize'),
+            "Role": data.get('Role'),
+            "Runtime": lambda_arn_to_runtime[arn],
+            "Timeout": data.get('Timeout'),
+            "TracingConfig": {},
+            "VpcConfig": {"SecurityGroupIds": [None], "SubnetIds": [None], "VpcId": None}
+        })
+        return jsonify(result or {})
     except Exception as e:
         return error_response('Unknown error: %s' % e)
 
@@ -605,7 +621,7 @@ def update_function_code(function):
     """
     data = json.loads(to_str(request.data))
     result = set_function_code(data, function)
-    return result or jsonify({})
+    return jsonify(result or {})
 
 
 @app.route('%s/functions/<function>/code' % PATH_ROOT, methods=['GET'])


Test patch: