### Is there an existing issue for this?

- [X] I have searched the existing issues

### Current Behavior

When using CDK to deploy a simple Lambda function the stack deploys first time and is successful. 
Though when deployed a second time it fails. 

If I change the name of the lambda it will be successfully. 

### Expected Behavior

To redeploy and update the lambda successfully 

### How are you starting LocalStack?

With a docker-compose file

### Steps To Reproduce

#### How are you starting localstack (e.g., `bin/localstack` command, arguments, or `docker-compose.yml`)

    `docker-compose up` 

Compose file: 

```yaml
version: '3.8'

services:
  localstack:
    container_name: '${LOCALSTACK_DOCKER_NAME-localstack_main}'
    image: localstack/localstack
    network_mode: bridge
    ports:
      - '127.0.0.1:53:53' # only required for Pro
      - '127.0.0.1:53:53/udp' # only required for Pro
      - '127.0.0.1:443:443' # only required for Pro
      - '127.0.0.1:4510-4530:4510-4530' # only required for Pro
      - '127.0.0.1:4566:4566'
      - '127.0.0.1:4571:4571'
    environment:
      - SERVICES=${SERVICES- }
      - DEBUG=${DEBUG- }
      - DATA_DIR=${DATA_DIR- }
      - LAMBDA_EXECUTOR=${LAMBDA_EXECUTOR- }
      - LOCALSTACK_API_KEY=${LOCALSTACK_API_KEY- } # only required for Pro
      - HOST_TMP_FOLDER=${TMPDIR:-/tmp/}localstack
      - DOCKER_HOST=unix:///var/run/docker.sock
    volumes:
      - '${TMPDIR:-/tmp}/localstack:/tmp/localstack'
      - '/var/run/docker.sock:/var/run/docker.sock'
```

Stack file:

```ts
import * as cdk from '@aws-cdk/core';
import * as lambda from '@aws-cdk/aws-lambda';
import { Construct } from '@aws-cdk/core';
import { Environment } from '../environment/environment';

function getStackName(environment: Environment): string {
  if (environment === 'local') {
    return 'local';
  }

  return `project-${environment}`;
}

export class TestServiceStack extends cdk.Stack {
  constructor(scope: cdk.App, environment: Environment, props?: cdk.StackProps) {
    super(scope, getStackName(environment), props);

    const lambda = this.createS3PackageReceived(this);
  }

  private createS3PackageReceived(owner: Construct): lambda.Function {
    const handler = new lambda.Function(owner, 'fn', {
      code: lambda.Code.fromInline(`exports.handler = async (event, context) => {return "hello"}`),
      handler: 'index.handler',
      functionName: 'test-func3',
      runtime: lambda.Runtime.NODEJS_14_X,
    });

    return handler;
  }
}
```

#### Client commands (e.g., AWS SDK code snippet, or sequence of "awslocal" commands)

Deployments are done with: 
```bash
docker-compose up
npx cdklocal bootstrap -v
npx cdklocal deploy --progress events --require-approval never # will be successful 
npx cdklocal deploy --progress events --require-approval never # will fail 
```

In the logs there are two interesting things: 
1.  `2021-10-25T22:35:51:WARNING:localstack.utils.cloudformation.template_deployer: Unable to deploy resource type "CDK::Metadata": {'Type': 'AWS::CDK::Metadata', 'Metadata': {'aws:cdk:path': 'local/CDKMetadata/Default'}, 'Condition': 'CDKMetadataAvailable', 'LogicalResourceId': 'CDKMetadata', 'Properties': {'Analytics': 'v2:deflate64:H4sIAAAAAAAAE02MSQoCMRBFz9L7dLXlgLgTGjxAPEFMIlQPVZBBFyF31yiCq/fgDwgFcQeb7myesbduHqwED+WajJ3VKBxTyDap8c7aR8nB+ubvwFEi4apwe/qfN5bFrDdnoFwy29Zqk59XRWaFomX5PDXWWhWL8zDF4YF7wCMcuikS9SFzotWD/vIFs9XuYq4AAAA='}}` 
  This warning is generated for both successful and unsuccessful deployments

2. 
```
2021-10-25T22:36:50:ERROR:lambda_api: Exception on /2015-03-31/functions/test-func/code [PUT]
Traceback (most recent call last):
  File "/opt/code/localstack/.venv/lib/python3.7/site-packages/flask/app.py", line 2073, in wsgi_app
    response = self.full_dispatch_request()
  File "/opt/code/localstack/.venv/lib/python3.7/site-packages/flask/app.py", line 1518, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/opt/code/localstack/.venv/lib/python3.7/site-packages/flask_cors/extension.py", line 165, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
  File "/opt/code/localstack/.venv/lib/python3.7/site-packages/flask/app.py", line 1516, in full_dispatch_request
    rv = self.dispatch_request()
  File "/opt/code/localstack/.venv/lib/python3.7/site-packages/flask/app.py", line 1502, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
  File "/opt/code/localstack/localstack/services/awslambda/lambda_api.py", line 1482, in update_function_code
    result = set_function_code(lambda_function)
  File "/opt/code/localstack/localstack/services/awslambda/lambda_api.py", line 1013, in set_function_code
    run_for_max_seconds(config.LAMBDA_CODE_EXTRACT_TIME, _set_and_configure)
  File "/opt/code/localstack/localstack/utils/common.py", line 1747, in run_for_max_seconds
    raise result
  File "/opt/code/localstack/localstack/utils/common.py", line 1728, in _worker
    fn_result = _function(*args, **kwargs)
  File "/opt/code/localstack/localstack/services/awslambda/lambda_api.py", line 1006, in _set_and_configure
    lambda_handler = do_set_function_code(lambda_function)
  File "/opt/code/localstack/localstack/services/awslambda/lambda_api.py", line 1081, in do_set_function_code
    "Uploaded Lambda code for runtime ({}) is not in Zip format".format(runtime)
localstack.services.awslambda.lambda_api.ClientError: Uploaded Lambda code for runtime (nodejs14.x) is not in Zip format
``` 
   this is generated on the second deployment. This stack trace is generated multiple times. 



### Environment

```markdown
- OS: OSX 11.6
- LocalStack: 
  - localstack_main | LocalStack version: 0.12.19.1
  - localstack_main | LocalStack Docker container id: deb3b6cc94e5
  - localstack_main | LocalStack build date: 2021-10-25
  - localstack_main | LocalStack build git hash: 109e0173
- package.json dependencies 

{
  "devDependencies": {
    "@aws-cdk/assert": "1.113.0",
    "@types/express": "^4.17.13",
    "@types/jest": "^26.0.23",
    "@types/supertest": "^2.0.11",
    "aws-cdk": "^1.129.0",
    "aws-cdk-local": "^1.65.8",
    "jest": "^26.6.3",
    "nodemon": "^2.0.10",
    "supertest": "^6.1.3",
    "ts-jest": "^26.5.5",
    "ts-node": "^10.0.0",
    "typescript": "^4.3.3"
  },
  "dependencies": {
    "@aws-cdk/aws-lambda": "^1.113.0",
    "@aws-cdk/aws-lambda-event-sources": "^1.129.0",
    "@aws-cdk/aws-s3": "^1.113.0",
    "@aws-cdk/core": "1.113.0",
    "@squiz-dx/asset-api": "^1.0.0",
    "express": "^4.17.1"
  }
}
```
```


### Anything else?

_No response_
"Description",
            "Timeout",
            "MemorySize",
            "Environment",
            "Runtime",
        )
        update_props = dict([(k, props[k]) for k in keys if k in props])
        update_props = self.resolve_refs_recursively(stack_name, update_props, resources)
        if "Timeout" in update_props:
            update_props["Timeout"] = int(update_props["Timeout"])
        if "Code" in props:
            code = props["Code"] or {}
            if not code.get("ZipFile"):
                LOG.debug(
                    'Updating code for Lambda "%s" from location: %s'
                    % (props["FunctionName"], code)
                )
            client.update_function_code(FunctionName=props["FunctionName"], **code)
        if "Environment" in update_props:
            environment_variables = update_props["Environment"].get("Variables", {})
            update_props["Environment"]["Variables"] = {
                k: str(v) for k, v in environment_variables.items()
            }
        return client.update_function_configuration(**update_props)
    @staticmethod
    def add_defaults(resource, stack_name: str):
        role_name = resource.get("Properties", {}).get("FunctionName")
        if not role_name:
            resource["Properties"]["FunctionName"] = generate_default_name(
                stack_name, resource["LogicalResourceId"]