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
LOCALSTACK_HOSTNAME = os.environ.get('LOCALSTACK_HOSTNAME', '').strip() or HOSTNAME
LAMBDA_REMOTE_DOCKER = os.environ.get('LAMBDA_REMOTE_DOCKER', '').lower().strip() in TRUE_STRINGS
LAMBDA_DOCKER_NETWORK = os.environ.get('LAMBDA_DOCKER_NETWORK', '').strip()
LAMBDA_CONTAINER_REGISTRY = os.environ.get('LAMBDA_CONTAINER_REGISTRY', '').strip() or DEFAULT_LAMBDA_CONTAINER_REGISTRY
LAMBDA_REMOVE_CONTAINERS = os.environ.get('LAMBDA_REMOVE_CONTAINERS', '').lower().strip() not in FALSE_STRINGS
DATA_DIR = os.environ.get('DATA_DIR', '').strip()
TMP_FOLDER = os.path.join(tempfile.gettempdir(), 'localstack')
for folder in [DATA_DIR, TMP_FOLDER]:
    if folder and not os.path.exists(folder):
        try:
            os.makedirs(folder)
        except Exception:
            
            
            pass
if TMP_FOLDER.startswith('/var/folders/') and os.path.exists('/private%s' % TMP_FOLDER):
    TMP_FOLDER = '/private%s' % TMP_FOLDER
HOST_TMP_FOLDER = os.environ.get('HOST_TMP_FOLDER', TMP_FOLDER)
USE_SSL = os.environ.get('USE_SSL', '').strip() in TRUE_STRINGS
DEFAULT_ENCODING = 'utf-8'
DOCKER_SOCK = os.environ.get('DOCKER_SOCK', '').strip() or '/var/run/docker.sock'
DOCKER_FLAGS = os.environ.get('DOCKER_FLAGS', '').strip()
DOCKER_CMD = os.environ.get('DOCKER_CMD', '').strip() or 'docker'
START_WEB = os.environ.get('START_WEB', '').strip() not in FALSE_STRINGS
PORT_WEB_UI = int(os.environ.get('PORT_WEB_UI', '').strip() or DEFAULT_PORT_WEB_UI)
PORT_WEB_UI_SSL = PORT_WEB_UI + 1
DOCKER_BRIDGE_IP = os.environ.get('DOCKER_BRIDGE_IP', '').strip()
EXTRA_CORS_ALLOWED_HEADERS = os.environ.get('EXTRA_CORS_ALLOWED_HEADERS', '').strip()
EXTRA_CORS_EXPOSE_HEADERS = os.environ.get('EXTRA_CORS_EXPOSE_HEADERS', '').strip()
def has_docker():