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
return result[0] if result else None
        elif resource_type == 'ApiGateway::Deployment':
            api_id = resource_props['RestApiId'] if resource else resource_id
            api_id = resolve_refs_recursively(stack_name, api_id, resources)
            if not api_id:
                return None
            result = aws_stack.connect_to_service('apigateway').get_deployments(restApiId=api_id)['items']
            
            return result[0] if result else None
        elif resource_type == 'ApiGateway::Method':
            api_id = resolve_refs_recursively(stack_name, resource_props['RestApiId'], resources)
            res_id = resolve_refs_recursively(stack_name, resource_props['ResourceId'], resources)
            if not api_id or not res_id:
                return None
            res_obj = aws_stack.connect_to_service('apigateway').get_resource(restApiId=api_id, resourceId=res_id)
            match = [v for (k, v) in res_obj['resourceMethods'].items()
                     if resource_props['HttpMethod'] in (v.get('httpMethod'), k)]
            int_props = resource_props.get('Integration')
            if int_props:
                match = [m for m in match if
                    m.get('methodIntegration', {}).get('type') == int_props.get('Type') and
                    m.get('methodIntegration', {}).get('httpMethod') == int_props.get('IntegrationHttpMethod')]
            return any(match) or None
        elif resource_type == 'ApiGateway::GatewayResponse':
            api_id = resolve_refs_recursively(stack_name, resource_props['RestApiId'], resources)
            client = aws_stack.connect_to_service('apigateway')
            result = client.get_gateway_response(restApiId=api_id, responseType=resource_props['ResponseType'])
            return result if 'responseType' in result else None
        elif resource_type == 'SQS::Queue':
            sqs_client = aws_stack.connect_to_service('sqs')