I am using the **latest** localstack docker image to test aws s3, lambda and cloudformation locally. s3 and lambda seems to be working fine but when I call cloudformation **create-stack** api it gives me a 502 BadGateway error. This is the command I am using

`aws cloudformation create-stack \
  --template-body template.yaml \
  --stack-name cfn-test \
  --parameters ParameterKey=BucketPrefix,ParameterValue=demo-bucket \
  --endpoint-url=http://localhost:4581`

This is the error I get:
`An error occurred (502) when calling the CreateStack operation (reached max retries: 4): Bad Gateway`

From docker logs I got the following error
`2019-12-31T22:12:09:ERROR:localstack.services.generic_proxy: Error forwarding request: 'str' object has no attribute 'get' Traceback (most recent call last):
  File "/opt/code/localstack/localstack/services/generic_proxy.py", line 242, in forward
    path=path, data=data, headers=forward_headers)
  File "/opt/code/localstack/localstack/services/cloudformation/cloudformation_listener.py", line 164, in forward_request
    modified_request = transform_template(req_data)
  File "/opt/code/localstack/localstack/services/cloudformation/cloudformation_listener.py", line 83, in transform_template
    if parsed.get('Transform') == 'AWS::Serverless-2016-10-31':
AttributeError: 'str' object has no attribute 'get'`

Although, when I try the **list-stacks** api it seems to be working fine
`aws --endpoint-url=http://localhost:4581 cloudformation list-stacks`

`{
    "StackSummaries": []
}`

`2019-12-31 22:10:51,865:API: 127.0.0.1 - - [31/Dec/2019 22:10:51] "GET / HTTP/1.1" 200 -`

I could not find a solution in any of the past issues or anywhere on the internet. Please assist
try:
        with open(os.devnull, 'w') as devnull:
            subprocess.check_output('docker ps', stderr=devnull, shell=True)
        return True
    except Exception:
        return False
def is_linux():
    try:
        out = subprocess.check_output('uname -a', shell=True)
        out = out.decode('utf-8') if isinstance(out, six.binary_type) else out
        return 'Linux' in out
    except subprocess.CalledProcessError:
        return False
LAMBDA_EXECUTOR = os.environ.get('LAMBDA_EXECUTOR', '').strip()
if not LAMBDA_EXECUTOR:
    LAMBDA_EXECUTOR = 'docker'
    if not has_docker():
        LAMBDA_EXECUTOR = 'local'
LAMBDA_FALLBACK_URL = os.environ.get('LAMBDA_FALLBACK_URL', '').strip()
CONFIG_ENV_VARS = ['SERVICES', 'HOSTNAME', 'HOSTNAME_EXTERNAL', 'LOCALSTACK_HOSTNAME', 'LAMBDA_FALLBACK_URL',
                   'LAMBDA_EXECUTOR', 'LAMBDA_REMOTE_DOCKER', 'LAMBDA_DOCKER_NETWORK', 'LAMBDA_REMOVE_CONTAINERS',
                   'USE_SSL', 'DEBUG', 'KINESIS_ERROR_PROBABILITY', 'DYNAMODB_ERROR_PROBABILITY', 'PORT_WEB_UI',
                   'START_WEB', 'DOCKER_BRIDGE_IP', 'DEFAULT_REGION', 'LAMBDA_JAVA_OPTS', 'LOCALSTACK_API_KEY',
                   'LAMBDA_CONTAINER_REGISTRY', 'TEST_AWS_ACCOUNT_ID']
for key, value in six.iteritems(DEFAULT_SERVICE_PORTS):
    clean_key = key.upper().replace('-', '_')
    CONFIG_ENV_VARS += [clean_key + '_BACKEND', clean_key + '_PORT', clean_key + '_PORT_EXTERNAL']
def ping(host):