Repository: localstack/localstack

Issue:
Cannot deploy to localstack lambda with SQS event source
I am trying to use both Serverless and LocalStack to create a function that uses SQS as an event source. Deploying to AWS works great. Deploying to LocalStack doesn't work when my Lambda has a SQS event fails. Deploying to LocalStack works if I comment out the function's list of events.

I threw together a small project that reproduces the problem: https://github.com/ashlux/serverless-localstack-sqs-lambda-event.git

## Steps to reproduce: 

1. Clone example project from https://github.com/ashlux/serverless-localstack-sqs-lambda-event.git.
1. Start LocalStack in Docker: `docker-compose up`
1. Deploy using Serverless: `serverless deploy --stage local`

## Expected results

I can deploy my lambda to LocalStack when it has a SQS event source.

## Actual results

Deploying to AWS works as expected. I get errors when deploying the lambda to LocalStack. Without a SQS event source, the deployment succeeds.

Serverless output isn't particularly interesting:

```
╰─➤  serverless deploy --stage local                                                                                                                                          130 ↵
Serverless: config.options_stage: local
Serverless: serverless.service.custom.stage: undefined
Serverless: serverless.service.provider.stage: dev
Serverless: config.stage: local
Serverless: Using serverless-localstack
Serverless: Reconfiguring service apigateway to use http://localhost:4567
Serverless: Reconfiguring service cloudformation to use http://localhost:4581
Serverless: Reconfiguring service cloudwatch to use http://localhost:4582
Serverless: Reconfiguring service lambda to use http://localhost:4574
Serverless: Reconfiguring service dynamodb to use http://localhost:4569
Serverless: Reconfiguring service kinesis to use http://localhost:4568
Serverless: Reconfiguring service route53 to use http://localhost:4580
Serverless: Reconfiguring service firehose to use http://localhost:4573
Serverless: Reconfiguring service stepfunctions to use http://localhost:4585
Serverless: Reconfiguring service es to use http://localhost:4578
Serverless: Reconfiguring service s3 to use http://localhost:4572
Serverless: Reconfiguring service ses to use http://localhost:4579
Serverless: Reconfiguring service sns to use http://localhost:4575
Serverless: Reconfiguring service sqs to use http://localhost:4576
Serverless: Reconfiguring service sts to use http://localhost:4592
Serverless: Reconfiguring service iam to use http://localhost:4593
Serverless: Creating deployment bucket my-s3-bucket
Serverless: Packaging service...
Serverless: Excluding development dependencies...
Serverless: Uploading CloudFormation file to S3...
Serverless: Uploading artifacts...
Serverless: Uploading service my-serverless-configuration-dev.zip file to S3 (8.43 MB)...
Serverless: Validating template...
Serverless: Skipping template validation: Unsupported in Localstack
Serverless: Creating Stack...
Serverless: Recoverable error occurred (500), sleeping for 5 seconds. Try 1 of 4
Serverless: Recoverable error occurred (500), sleeping for 5 seconds. Try 2 of 4
Serverless: Recoverable error occurred (500), sleeping for 5 seconds. Try 3 of 4
Serverless: Recoverable error occurred (500), sleeping for 5 seconds. Try 4 of 4
 
  Serverless Error ---------------------------------------
 
  500
 
  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Issues:        forum.serverless.com
 
  Your Environment Information ---------------------------
     OS:                     darwin
     Node Version:           8.9.4
     Serverless Version:     1.41.0
```

LocalStack logs:

```
╰─➤  docker-compose up
Creating volume "localstack-volume" with default driver
Creating my-localstack ... done
Attaching to my-localstack
my-localstack | Waiting for all LocalStack services to be ready
my-localstack | 2019-05-06 18:34:13,431 INFO Set uid to user 0 succeeded
my-localstack | 2019-05-06 18:34:13,433 INFO supervisord started with pid 7
my-localstack | 2019-05-06 18:34:14,436 INFO spawned: 'dashboard' with pid 11
my-localstack | 2019-05-06 18:34:14,439 INFO spawned: 'infra' with pid 12
my-localstack | (. .venv/bin/activate; bin/localstack web)
my-localstack | 2019-05-06 18:34:15,448 INFO success: dashboard entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
my-localstack | 2019-05-06 18:34:15,448 INFO success: infra entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
my-localstack | 2019-05-06T18:34:16:INFO:werkzeug:  * Running on http://0.0.0.0:8080/ (Press CTRL+C to quit)
my-localstack | 2019-05-06T18:34:16:INFO:werkzeug:  * Restarting with stat
my-localstack | 2019-05-06T18:34:19:WARNING:werkzeug:  * Debugger is active!
my-localstack | 2019-05-06T18:34:19:INFO:werkzeug:  * Debugger PIN: 330-466-272
my-localstack | Waiting for all LocalStack services to be ready
my-localstack | * Running on http://0.0.0.0:4563/ (Press CTRL+C to quit)
my-localstack | * Running on http://0.0.0.0:4593/ (Press CTRL+C to quit)
my-localstack | 2019-05-06T18:34:22:INFO:werkzeug:  * Running on http://0.0.0.0:4559/ (Press CTRL+C to quit)
my-localstack | 18:34:23.181 [elasticmq-akka.actor.default-dispatcher-4] INFO  akka.event.slf4j.Slf4jLogger - Slf4jLogger started
my-localstack | 127.0.0.1 - - [06/May/2019 18:34:24] "GET / HTTP/1.1" 200 -
my-localstack | Ready.
my-localstack | 127.0.0.1 - - [06/May/2019 18:34:24] "GET / HTTP/1.1" 200 -
my-localstack | 127.0.0.1 - - [06/May/2019 18:34:24] "PUT /my-s3-bucket HTTP/1.1" 200 -
my-localstack | 18:34:25.531 [elasticmq-akka.actor.default-dispatcher-2] INFO  o.e.rest.sqs.TheSQSRestServerBuilder - Started SQS rest server, bind address 0.0.0.0:4561, visible server address http://4ccc7c3ed864:4576
my-localstack | 18:34:25.533 [main] INFO  org.elasticmq.server.Main$ - === ElasticMQ server (0.14.5) started in 6956 ms ===
my-localstack | 2019-05-06T18:34:28:WARNING:localstack.services.cloudformation.cloudformation_listener: Error response from CloudFormation (400) POST /: <ErrorResponse xmlns="http://cloudformation.amazonaws.com/doc/2010-05-15/">
my-localstack |   <Error>
my-localstack |     <Type>Sender</Type>
my-localstack |     <Code>ValidationError</Code>
my-localstack |     <Message>Stack with id my-serverless-configuration-dev-local does not exist</Message>
my-localstack |   </Error>
my-localstack |   <RequestId>cf4c737e-5ae2-11e4-a7c9-ad44eEXAMPLE</RequestId>
my-localstack | </ErrorResponse>
my-localstack | 127.0.0.1 - - [06/May/2019 18:34:28] "GET /my-s3-bucket?location HTTP/1.1" 200 -
my-localstack | 2019-05-06T18:34:28:INFO:werkzeug: 127.0.0.1 - - [06/May/2019 18:34:28] "POST / HTTP/1.1" 400 -
my-localstack | 127.0.0.1 - - [06/May/2019 18:34:28] "GET /my-s3-bucket?list-type=2&prefix=serverless%2Fmy-serverless-configuration-dev%2Flocal HTTP/1.1" 200 -
my-localstack | 172.20.0.1 - - [06/May/2019 18:34:28] "POST / HTTP/1.1" 200 -
my-localstack | 127.0.0.1 - - [06/May/2019 18:34:28] "PUT /my-s3-bucket/serverless/my-serverless-configuration-dev/local/1557167668071-2019-05-06T18%3A34%3A28.071Z/compiled-cloudformation-template.json HTTP/1.1" 200 -
my-localstack | 127.0.0.1 - - [06/May/2019 18:34:28] "POST /my-s3-bucket/serverless/my-serverless-configuration-dev/local/1557167668071-2019-05-06T18%3A34%3A28.071Z/my-serverless-configuration-dev.zip?uploads HTTP/1.1" 200 -
my-localstack | 127.0.0.1 - - [06/May/2019 18:34:28] "PUT /my-s3-bucket/serverless/my-serverless-configuration-dev/local/1557167668071-2019-05-06T18%3A34%3A28.071Z/my-serverless-configuration-dev.zip?partNumber=2&uploadId=3nVr9cOz1618e5vt17D9Siq8te3ZWj5LtcYR7z5qAhvFovKmNnuPtmr6gw HTTP/1.1" 200 -
my-localstack | 127.0.0.1 - - [06/May/2019 18:34:28] "PUT /my-s3-bucket/serverless/my-serverless-configuration-dev/local/1557167668071-2019-05-06T18%3A34%3A28.071Z/my-serverless-configuration-dev.zip?partNumber=1&uploadId=3nVr9cOz1618e5vt17D9Siq8te3ZWj5LtcYR7z5qAhvFovKmNnuPtmr6gw HTTP/1.1" 200 -
my-localstack | 127.0.0.1 - - [06/May/2019 18:34:28] "POST /my-s3-bucket/serverless/my-serverless-configuration-dev/local/1557167668071-2019-05-06T18%3A34%3A28.071Z/my-serverless-configuration-dev.zip?uploadId=3nVr9cOz1618e5vt17D9Siq8te3ZWj5LtcYR7z5qAhvFovKmNnuPtmr6gw HTTP/1.1" 200 -
my-localstack | 127.0.0.1 - - [06/May/2019 18:34:28] "GET /my-s3-bucket/serverless/my-serverless-configuration-dev/local/1557167668071-2019-05-06T18%3A34%3A28.071Z/compiled-cloudformation-template.json HTTP/1.1" 200 -
my-localstack | 2019-05-06T18:34:28:DEBUG:__main__: Currently updating stack resource my-serverless-configuration-dev-local/MyDashlambdaLogGroup: None
my-localstack | 2019-05-06T18:34:28:DEBUG:__main__: Resource MyDashlambdaLogGroup need not be deployed: {'Type': 'AWS::Logs::LogGroup', 'Properties': {'LogGroupName': '/aws/lambda/my-lambda-dev'}}
my-localstack | 2019-05-06T18:34:28:DEBUG:__main__: Deploying CloudFormation resource: {'Type': 'AWS::Logs::LogGroup', 'Properties': {'LogGroupName': '/aws/lambda/my-lambda-dev'}}
my-localstack | 2019-05-06T18:34:28:WARNING:localstack.utils.cloudformation.template_deployer: Unable to update resource type "Logs::LogGroup", id "MyDashlambdaLogGroup"
my-localstack | 2019-05-06T18:34:28:DEBUG:__main__: Currently updating stack resource my-serverless-configuration-dev-local/MyDashlambdaEventSourceMappingSQSMySQS: None
my-localstack | 2019-05-06T18:34:28:DEBUG:__main__: Currently updating stack resource my-serverless-configuration-dev-local/MySQS: None
my-localstack | 2019-05-06T18:34:29:WARNING:localstack.services.awslambda.lambda_api: Function not found: arn:aws:lambda:us-east-1:000000000000:function:my-lambda-dev
my-localstack | 2019-05-06T18:34:29:DEBUG:__main__: Deploying CloudFormation resource: {'Type': 'AWS::SQS::Queue', 'Properties': {'QueueName': 'my-sqs-dev'}}
my-localstack | 2019-05-06T18:34:29:DEBUG:localstack.utils.cloudformation.template_deployer: Deploying resource type "SQS::Queue" id "MySQS"
my-localstack | 2019-05-06T18:34:29:DEBUG:localstack.utils.cloudformation.template_deployer: Request for creating resource type "SQS::Queue": {'QueueName': 'my-sqs-dev'}
my-localstack | 18:34:29.630 [elasticmq-akka.actor.default-dispatcher-3] INFO  o.elasticmq.actor.QueueManagerActor - Creating queue QueueData(my-sqs-dev,MillisVisibilityTimeout(30000),PT0S,PT0S,2019-05-06T18:34:29.522Z,2019-05-06T18:34:29.522Z,None,false,false,None,None,Map())
my-localstack | 2019-05-06T18:34:29:DEBUG:__main__: Currently updating stack resource my-serverless-configuration-dev-local/MyDashlambdaLambdaFunction: None
my-localstack | 2019-05-06T18:34:29:DEBUG:__main__: Currently updating stack resource my-serverless-configuration-dev-local/IamRoleLambdaExecution: None
my-localstack | 2019-05-06T18:34:29:DEBUG:__main__: Resource IamRoleLambdaExecution need not be deployed: {'Type': 'AWS::IAM::Role', 'Properties': {'RoleName': 'my-serverless-configuration-dev-local-us-east-1-lambdaRole', 'Path': '/', 'Policies': [{'PolicyName': 'local-my-serverless-configuration-dev-lambda', 'PolicyDocument': {'Version': '2012-10-17', 'Statement': [{'Action': ['logs:CreateLogStream'], 'Resource': [u'arn:aws:logs:us-east-1:123456789012:log-group:/aws/lambda/my-lambda-dev:*'], 'Effect': 'Allow'}, {'Action': ['logs:PutLogEvents'], 'Resource': [u'arn:aws:logs:us-east-1:123456789012:log-group:/aws/lambda/my-lambda-dev:*:*'], 'Effect': 'Allow'}, {'Action': ['xray:PutTraceSegments', 'xray:PutTelemetryRecords'], 'Resource': ['*'], 'Effect': 'Allow'}, {'Action': ['sqs:ReceiveMessage', 'sqs:DeleteMessage', 'sqs:GetQueueAttributes'], 'Resource': [u'arn:aws:sqs:us-east-1:123456789012:my-sqs-dev'], 'Effect': 'Allow'}]}}], 'AssumeRolePolicyDocument': {'Version': '2012-10-17', 'Statement': [{'Action': ['sts:AssumeRole'], 'Effect': 'Allow', 'Principal': {'Service': ['lambda.amazonaws.com']}}]}}}
my-localstack | 2019-05-06T18:34:29:DEBUG:__main__: Deploying CloudFormation resource: {'Type': 'AWS::IAM::Role', 'Properties': {'RoleName': 'my-serverless-configuration-dev-local-us-east-1-lambdaRole', 'Path': '/', 'Policies': [{'PolicyName': 'local-my-serverless-configuration-dev-lambda', 'PolicyDocument': {'Version': '2012-10-17', 'Statement': [{'Action': ['logs:CreateLogStream'], 'Resource': [u'arn:aws:logs:us-east-1:123456789012:log-group:/aws/lambda/my-lambda-dev:*'], 'Effect': 'Allow'}, {'Action': ['logs:PutLogEvents'], 'Resource': [u'arn:aws:logs:us-east-1:123456789012:log-group:/aws/lambda/my-lambda-dev:*:*'], 'Effect': 'Allow'}, {'Action': ['xray:PutTraceSegments', 'xray:PutTelemetryRecords'], 'Resource': ['*'], 'Effect': 'Allow'}, {'Action': ['sqs:ReceiveMessage', 'sqs:DeleteMessage', 'sqs:GetQueueAttributes'], 'Resource': [u'arn:aws:sqs:us-east-1:123456789012:my-sqs-dev'], 'Effect': 'Allow'}]}}], 'AssumeRolePolicyDocument': {'Version': '2012-10-17', 'Statement': [{'Action': ['sts:AssumeRole'], 'Effect': 'Allow', 'Principal': {'Service': ['lambda.amazonaws.com']}}]}}}
my-localstack | 2019-05-06T18:34:29:WARNING:localstack.utils.cloudformation.template_deployer: Unable to update resource type "IAM::Role", id "IamRoleLambdaExecution"
my-localstack | 127.0.0.1 - - [06/May/2019 18:34:29] "GET /my-s3-bucket/serverless/my-serverless-configuration-dev/local/1557167668071-2019-05-06T18%3A34%3A28.071Z/my-serverless-configuration-dev.zip HTTP/1.1" 200 -
my-localstack | 2019-05-06T18:34:29:DEBUG:__main__: Deploying CloudFormation resource: {'Type': 'AWS::Lambda::Function', 'Properties': {'TracingConfig': {'Mode': 'Active'}, 'Code': {'S3Bucket': 'my-s3-bucket', 'S3Key': 'serverless/my-serverless-configuration-dev/local/1557167668071-2019-05-06T18:34:28.071Z/my-serverless-configuration-dev.zip'}, 'FunctionName': 'my-lambda-dev', 'MemorySize': 1024, 'Handler': 'index.handler', 'Role': u'arn:aws:iam::000000000000:role/my-serverless-configuration-dev-local-IamRoleLambdaExecution-180484479A-Z53', 'Timeout': 120, 'Runtime': 'nodejs8.10'}, 'DependsOn': ['MyDashlambdaLogGroup', 'IamRoleLambdaExecution']}
my-localstack | 2019-05-06T18:34:29:DEBUG:localstack.utils.cloudformation.template_deployer: Deploying resource type "Lambda::Function" id "MyDashlambdaLambdaFunction"
my-localstack | 2019-05-06T18:34:29:DEBUG:localstack.utils.cloudformation.template_deployer: Request for creating resource type "Lambda::Function": {'Code': {'S3Bucket': 'my-s3-bucket', 'S3Key': 'serverless/my-serverless-configuration-dev/local/1557167668071-2019-05-06T18:34:28.071Z/my-serverless-configuration-dev.zip'}, 'FunctionName': 'my-lambda-dev', 'MemorySize': 1024, 'Handler': 'index.handler', 'Role': 'test_role', 'Timeout': 120, 'Runtime': 'nodejs8.10'}
my-localstack | 127.0.0.1 - - [06/May/2019 18:34:30] "HEAD /my-s3-bucket/serverless/my-serverless-configuration-dev/local/1557167668071-2019-05-06T18%3A34%3A28.071Z/my-serverless-configuration-dev.zip HTTP/1.1" 200 -
my-localstack | 127.0.0.1 - - [06/May/2019 18:34:30] "GET /my-s3-bucket/serverless/my-serverless-configuration-dev/local/1557167668071-2019-05-06T18%3A34%3A28.071Z/my-serverless-configuration-dev.zip HTTP/1.1" 206 -
my-localstack | 127.0.0.1 - - [06/May/2019 18:34:30] "GET /my-s3-bucket/serverless/my-serverless-configuration-dev/local/1557167668071-2019-05-06T18%3A34%3A28.071Z/my-serverless-configuration-dev.zip HTTP/1.1" 206 -
my-localstack | 2019-05-06T18:34:31:WARNING:localstack.services.cloudformation.cloudformation_listener: Error response from CloudFormation (500) POST /: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
my-localstack | <title>500 Internal Server Error</title>
my-localstack | <h1>Internal Server Error</h1>
my-localstack | <p>The server encountered an internal error and was unable to complete your request.  Either the server is overloaded or there is an error in the application.</p>
my-localstack | 
my-localstack | 2019-05-06T18:34:31:INFO:werkzeug: 127.0.0.1 - - [06/May/2019 18:34:31] "POST / HTTP/1.1" 500 -
my-localstack | 2019-05-06T18:34:31:ERROR:werkzeug: Error on request:
my-localstack | Traceback (most recent call last):
my-localstack | File "/opt/code/localstack/.venv/lib/python2.7/site-packages/werkzeug/serving.py", line 270, in run_wsgi
my-localstack | execute(self.server.app)
my-localstack | File "/opt/code/localstack/.venv/lib/python2.7/site-packages/werkzeug/serving.py", line 258, in execute
my-localstack | application_iter = app(environ, start_response)
my-localstack | File "/opt/code/localstack/.venv/lib/python2.7/site-packages/moto/server.py", line 101, in __call__
my-localstack | return backend_app(environ, start_response)
my-localstack | File "/opt/code/localstack/.venv/lib/python2.7/site-packages/flask/app.py", line 1997, in __call__
my-localstack | return self.wsgi_app(environ, start_response)
my-localstack | File "/opt/code/localstack/.venv/lib/python2.7/site-packages/flask/app.py", line 1985, in wsgi_app
my-localstack | response = self.handle_exception(e)
my-localstack | File "/opt/code/localstack/.venv/lib/python2.7/site-packages/flask/app.py", line 1540, in handle_exception
my-localstack | reraise(exc_type, exc_value, tb)
my-localstack | File "/opt/code/localstack/.venv/lib/python2.7/site-packages/flask/app.py", line 1982, in wsgi_app
my-localstack | response = self.full_dispatch_request()
my-localstack | File "/opt/code/localstack/.venv/lib/python2.7/site-packages/flask/app.py", line 1614, in full_dispatch_request
my-localstack | rv = self.handle_user_exception(e)
my-localstack | File "/opt/code/localstack/.venv/lib/python2.7/site-packages/flask/app.py", line 1517, in handle_user_exception
my-localstack | reraise(exc_type, exc_value, tb)
my-localstack | File "/opt/code/localstack/.venv/lib/python2.7/site-packages/flask/app.py", line 1612, in full_dispatch_request
my-localstack | rv = self.dispatch_request()
my-localstack | File "/opt/code/localstack/.venv/lib/python2.7/site-packages/flask/app.py", line 1598, in dispatch_request
my-localstack | return self.view_functions[rule.endpoint](**req.view_args)
my-localstack | File "/opt/code/localstack/.venv/lib/python2.7/site-packages/moto/core/utils.py", line 140, in __call__
my-localstack | result = self.callback(request, request.url, {})
my-localstack | File "/opt/code/localstack/.venv/lib/python2.7/site-packages/moto/core/responses.py", line 117, in dispatch
my-localstack | return cls()._dispatch(*args, **kwargs)
my-localstack | File "/opt/code/localstack/.venv/lib/python2.7/site-packages/moto/core/responses.py", line 200, in _dispatch
my-localstack | return self.call_action()
my-localstack | File "/opt/code/localstack/.venv/lib/python2.7/site-packages/moto/core/responses.py", line 274, in call_action
my-localstack | response = method()
my-localstack | File "/opt/code/localstack/.venv/lib/python2.7/site-packages/moto/cloudformation/responses.py", line 67, in create_stack
my-localstack | role_arn=role_arn,
my-localstack | File "/opt/code/localstack/.venv/lib/python2.7/site-packages/moto/cloudformation/models.py", line 164, in create_stack
my-localstack | create_change_set=create_change_set,
my-localstack | File "/opt/code/localstack/.venv/lib/python2.7/site-packages/moto/cloudformation/models.py", line 42, in __init__
my-localstack | self.resource_map = self._create_resource_map()
my-localstack | File "/opt/code/localstack/.venv/lib/python2.7/site-packages/moto/cloudformation/models.py", line 50, in _create_resource_map
my-localstack | resource_map.create()
my-localstack | File "/opt/code/localstack/.venv/lib/python2.7/site-packages/moto/cloudformation/parsing.py", line 463, in create
my-localstack | if isinstance(self[resource], ec2_models.TaggedEC2Resource):
my-localstack | File "/opt/code/localstack/.venv/lib/python2.7/site-packages/moto/cloudformation/parsing.py", line 403, in __getitem__
my-localstack | resource_logical_id, resource_json, self, self._region_name)
my-localstack | File "/home/travis/build/localstack/localstack/localstack/services/cloudformation/cloudformation_starter.py", line 107, in parse_and_create_resource
my-localstack | 
my-localstack | File "/opt/code/localstack/.venv/lib/python2.7/site-packages/moto/cloudformation/parsing.py", line 299, in parse_and_create_resource
my-localstack | resource_name, resource_json, region_name)
my-localstack | File "/opt/code/localstack/.venv/lib/python2.7/site-packages/moto/awslambda/models.py", line 445, in create_from_cloudformation_json
my-localstack | 'StartingPosition': properties['StartingPosition']
my-localstack | KeyError: u'StartingPosition'
my-localstack | 127.0.0.1 - - [06/May/2019 18:34:31] "GET /my-s3-bucket/serverless/my-serverless-configuration-dev/local/1557167668071-2019-05-06T18%3A34%3A28.071Z/compiled-cloudformation-template.json HTTP/1.1" 200 -
my-localstack | 2019-05-06T18:34:31:DEBUG:__main__: Currently updating stack resource my-serverless-configuration-dev-local/MyDashlambdaLogGroup: False
my-localstack | 2019-05-06T18:34:31:DEBUG:__main__: Resource MyDashlambdaLogGroup need not be deployed: {'Type': 'AWS::Logs::LogGroup', 'Properties': {'LogGroupName': '/aws/lambda/my-lambda-dev'}}
my-localstack | 2019-05-06T18:34:31:DEBUG:__main__: Deploying CloudFormation resource: {'Type': 'AWS::Logs::LogGroup', 'Properties': {'LogGroupName': '/aws/lambda/my-lambda-dev'}}
my-localstack | 2019-05-06T18:34:31:WARNING:localstack.utils.cloudformation.template_deployer: Unable to update resource type "Logs::LogGroup", id "MyDashlambdaLogGroup"
my-localstack | 2019-05-06T18:34:31:DEBUG:__main__: Currently updating stack resource my-serverless-configuration-dev-local/MyDashlambdaEventSourceMappingSQSMySQS: None
my-localstack | 2019-05-06T18:34:31:DEBUG:__main__: Currently updating stack resource my-serverless-configuration-dev-local/MySQS: False
my-localstack | 2019-05-06T18:34:31:WARNING:localstack.services.cloudformation.cloudformation_listener: Error response from CloudFormation (500) POST /: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
my-localstack | <title>500 Internal Server Error</title>
my-localstack | <h1>Internal Server Error</h1>
my-localstack | <p>The server encountered an internal error and was unable to complete your request.  Either the server is overloaded or there is an error in the application.</p>
my-localstack | 
my-localstack | 2019-05-06T18:34:32:WARNING:localstack.services.cloudformation.cloudformation_listener: Error response from CloudFormation (500) POST /: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
my-localstack | <title>500 Internal Server Error</title>
my-localstack | <h1>Internal Server Error</h1>
my-localstack | <p>The server encountered an internal error and was unable to complete your request.  Either the server is overloaded or there is an error in the application.</p>
my-localstack | 
my-localstack | 2019-05-06T18:34:31:DEBUG:__main__: Deploying CloudFormation resource: {'Type': 'AWS::SQS::Queue', 'Properties': {'QueueName': 'my-sqs-dev'}}
my-localstack | 2019-05-06T18:34:31:DEBUG:localstack.utils.cloudformation.template_deployer: Deploying resource type "SQS::Queue" id "MySQS"
my-localstack | 2019-05-06T18:34:31:DEBUG:localstack.utils.cloudformation.template_deployer: Request for creating resource type "SQS::Queue": {'QueueName': 'my-sqs-dev'}
my-localstack | 2019-05-06T18:34:31:DEBUG:__main__: Currently updating stack resource my-serverless-configuration-dev-local/MyDashlambdaLambdaFunction: False
my-localstack | 2019-05-06T18:34:31:DEBUG:__main__: Currently updating stack resource my-serverless-configuration-dev-local/IamRoleLambdaExecution: False
my-localstack | 2019-05-06T18:34:31:DEBUG:__main__: Resource IamRoleLambdaExecution need not be deployed: {'Type': 'AWS::IAM::Role', 'Properties': {'RoleName': 'my-serverless-configuration-dev-local-us-east-1-lambdaRole', 'Path': '/', 'Policies': [{'PolicyName': 'local-my-serverless-configuration-dev-lambda', 'PolicyDocument': {'Version': '2012-10-17', 'Statement': [{'Action': ['logs:CreateLogStream'], 'Resource': [u'arn:aws:logs:us-east-1:123456789012:log-group:/aws/lambda/my-lambda-dev:*'], 'Effect': 'Allow'}, {'Action': ['logs:PutLogEvents'], 'Resource': [u'arn:aws:logs:us-east-1:123456789012:log-group:/aws/lambda/my-lambda-dev:*:*'], 'Effect': 'Allow'}, {'Action': ['xray:PutTraceSegments', 'xray:PutTelemetryRecords'], 'Resource': ['*'], 'Effect': 'Allow'}, {'Action': ['sqs:ReceiveMessage', 'sqs:DeleteMessage', 'sqs:GetQueueAttributes'], 'Resource': [u'arn:aws:sqs:us-east-1:123456789012:my-sqs-dev'], 'Effect': 'Allow'}]}}], 'AssumeRolePolicyDocument': {'Version': '2012-10-17', 'Statement': [{'Action': ['sts:AssumeRole'], 'Effect': 'Allow', 'Principal': {'Service': ['lambda.amazonaws.com']}}]}}}
my-localstack | 2019-05-06T18:34:31:DEBUG:__main__: Deploying CloudFormation resource: {'Type': 'AWS::IAM::Role', 'Properties': {'RoleName': 'my-serverless-configuration-dev-local-us-east-1-lambdaRole', 'Path': '/', 'Policies': [{'PolicyName': 'local-my-serverless-configuration-dev-lambda', 'PolicyDocument': {'Version': '2012-10-17', 'Statement': [{'Action': ['logs:CreateLogStream'], 'Resource': [u'arn:aws:logs:us-east-1:123456789012:log-group:/aws/lambda/my-lambda-dev:*'], 'Effect': 'Allow'}, {'Action': ['logs:PutLogEvents'], 'Resource': [u'arn:aws:logs:us-east-1:123456789012:log-group:/aws/lambda/my-lambda-dev:*:*'], 'Effect': 'Allow'}, {'Action': ['xray:PutTraceSegments', 'xray:PutTelemetryRecords'], 'Resource': ['*'], 'Effect': 'Allow'}, {'Action': ['sqs:ReceiveMessage', 'sqs:DeleteMessage', 'sqs:GetQueueAttributes'], 'Resource': [u'arn:aws:sqs:us-east-1:123456789012:my-sqs-dev'], 'Effect': 'Allow'}]}}], 'AssumeRolePolicyDocument': {'Version': '2012-10-17', 'Statement': [{'Action': ['sts:AssumeRole'], 'Effect': 'Allow', 'Principal': {'Service': ['lambda.amazonaws.com']}}]}}}
my-localstack | 2019-05-06T18:34:31:WARNING:localstack.utils.cloudformation.template_deployer: Unable to update resource type "IAM::Role", id "IamRoleLambdaExecution"
my-localstack | 127.0.0.1 - - [06/May/2019 18:34:31] "GET /my-s3-bucket/serverless/my-serverless-configuration-dev/local/1557167668071-2019-05-06T18%3A34%3A28.071Z/my-serverless-configuration-dev.zip HTTP/1.1" 200 -
my-localstack | 2019-05-06T18:34:31:DEBUG:__main__: Deploying CloudFormation resource: {'Type': 'AWS::Lambda::Function', 'Properties': {'TracingConfig': {'Mode': 'Active'}, 'Code': {'S3Bucket': 'my-s3-bucket', 'S3Key': 'serverless/my-serverless-configuration-dev/local/1557167668071-2019-05-06T18:34:28.071Z/my-serverless-configuration-dev.zip'}, 'FunctionName': 'my-lambda-dev', 'MemorySize': 1024, 'Handler': 'index.handler', 'Role': u'arn:aws:iam::000000000000:role/my-serverless-configuration-dev-local-IamRoleLambdaExecution-58882945A-Z849', 'Timeout': 120, 'Runtime': 'nodejs8.10'}, 'DependsOn': ['MyDashlambdaLogGroup', 'IamRoleLambdaExecution']}
my-localstack | 2019-05-06T18:34:31:INFO:werkzeug: 127.0.0.1 - - [06/May/2019 18:34:31] "POST / HTTP/1.1" 500 -
my-localstack | 2019-05-06T18:34:31:ERROR:werkzeug: Error on request:
my-localstack | Traceback (most recent call last):
my-localstack | File "/opt/code/localstack/.venv/lib/python2.7/site-packages/werkzeug/serving.py", line 270, in run_wsgi
my-localstack | execute(self.server.app)
my-localstack | File "/opt/code/localstack/.venv/lib/python2.7/site-packages/werkzeug/serving.py", line 258, in execute
my-localstack | application_iter = app(environ, start_response)
my-localstack | File "/opt/code/localstack/.venv/lib/python2.7/site-packages/moto/server.py", line 101, in __call__
my-localstack | return backend_app(environ, start_response)
my-localstack | File "/opt/code/localstack/.venv/lib/python2.7/site-packages/flask/app.py", line 1997, in __call__
my-localstack | return self.wsgi_app(environ, start_response)
my-localstack | File "/opt/code/localstack/.venv/lib/python2.7/site-packages/flask/app.py", line 1985, in wsgi_app
my-localstack | response = self.handle_exception(e)
my-localstack | File "/opt/code/localstack/.venv/lib/python2.7/site-packages/flask/app.py", line 1540, in handle_exception
my-localstack | reraise(exc_type, exc_value, tb)
my-localstack | File "/opt/code/localstack/.venv/lib/python2.7/site-packages/flask/app.py", line 1982, in wsgi_app
my-localstack | response = self.full_dispatch_request()
my-localstack | File "/opt/code/localstack/.venv/lib/python2.7/site-packages/flask/app.py", line 1614, in full_dispatch_request
my-localstack | rv = self.handle_user_exception(e)
my-localstack | File "/opt/code/localstack/.venv/lib/python2.7/site-packages/flask/app.py", line 1517, in handle_user_exception
my-localstack | reraise(exc_type, exc_value, tb)
my-localstack | File "/opt/code/localstack/.venv/lib/python2.7/site-packages/flask/app.py", line 1612, in full_dispatch_request
my-localstack | rv = self.dispatch_request()
my-localstack | File "/opt/code/localstack/.venv/lib/python2.7/site-packages/flask/app.py", line 1598, in dispatch_request
my-localstack | return self.view_functions[rule.endpoint](**req.view_args)
my-localstack | File "/opt/code/localstack/.venv/lib/python2.7/site-packages/moto/core/utils.py", line 140, in __call__
my-localstack | result = self.callback(request, request.url, {})
my-localstack | File "/opt/code/localstack/.venv/lib/python2.7/site-packages/moto/core/responses.py", line 117, in dispatch
my-localstack | return cls()._dispatch(*args, **kwargs)
my-localstack | File "/opt/code/localstack/.venv/lib/python2.7/site-packages/moto/core/responses.py", line 200, in _dispatch
my-localstack | return self.call_action()
my-localstack | File "/opt/code/localstack/.venv/lib/python2.7/site-packages/moto/core/responses.py", line 274, in call_action
my-localstack | response = method()
my-localstack | File "/opt/code/localstack/.venv/lib/python2.7/site-packages/moto/cloudformation/responses.py", line 67, in create_stack
my-localstack | role_arn=role_arn,
my-localstack | File "/opt/code/localstack/.venv/lib/python2.7/site-packages/moto/cloudformation/models.py", line 164, in create_stack
my-localstack | create_change_set=create_change_set,
my-localstack | File "/opt/code/localstack/.venv/lib/python2.7/site-packages/moto/cloudformation/models.py", line 42, in __init__
my-localstack | self.resource_map = self._create_resource_map()
my-localstack | File "/opt/code/localstack/.venv/lib/python2.7/site-packages/moto/cloudformation/models.py", line 50, in _create_resource_map
my-localstack | resource_map.create()
my-localstack | File "/opt/code/localstack/.venv/lib/python2.7/site-packages/moto/cloudformation/parsing.py", line 463, in create
my-localstack | if isinstance(self[resource], ec2_models.TaggedEC2Resource):
my-localstack | File "/opt/code/localstack/.venv/lib/python2.7/site-packages/moto/cloudformation/parsing.py", line 403, in __getitem__
my-localstack | resource_logical_id, resource_json, self, self._region_name)
my-localstack | File "/home/travis/build/localstack/localstack/localstack/services/cloudformation/cloudformation_starter.py", line 107, in parse_and_create_resource
my-localstack | 
my-localstack | File "/opt/code/localstack/.venv/lib/python2.7/site-packages/moto/cloudformation/parsing.py", line 299, in parse_and_create_resource
my-localstack | resource_name, resource_json, region_name)
my-localstack | File "/opt/code/localstack/.venv/lib/python2.7/site-packages/moto/awslambda/models.py", line 445, in create_from_cloudformation_json
my-localstack | 'StartingPosition': properties['StartingPosition']
my-localstack | KeyError: u'StartingPosition'
my-localstack | 127.0.0.1 - - [06/May/2019 18:34:31] "GET /my-s3-bucket/serverless/my-serverless-configuration-dev/local/1557167668071-2019-05-06T18%3A34%3A28.071Z/compiled-cloudformation-template.json HTTP/1.1" 200 -
my-localstack | 2019-05-06T18:34:31:DEBUG:__main__: Currently updating stack resource my-serverless-configuration-dev-local/MyDashlambdaLogGroup: False
my-localstack | 2019-05-06T18:34:31:DEBUG:__main__: Resource MyDashlambdaLogGroup need not be deployed: {'Type': 'AWS::Logs::LogGroup', 'Properties': {'LogGroupName': '/aws/lambda/my-lambda-dev'}}
my-localstack | 2019-05-06T18:34:31:DEBUG:__main__: Deploying CloudFormation resource: {'Type': 'AWS::Logs::LogGroup', 'Properties': {'LogGroupName': '/aws/lambda/my-lambda-dev'}}
my-localstack | 2019-05-06T18:34:31:WARNING:localstack.utils.cloudformation.template_deployer: Unable to update resource type "Logs::LogGroup", id "MyDashlambdaLogGroup"

... snip ...
```

The `.serverless/cloudformation-template-update-stack.json`:

```json
{
  "AWSTemplateFormatVersion": "2010-09-09",
  "Description": "The AWS CloudFormation template for this Serverless application",
  "Resources": {
    "MyDashlambdaLogGroup": {
      "Type": "AWS::Logs::LogGroup",
      "Properties": {
        "LogGroupName": "/aws/lambda/my-lambda-dev"
      }
    },
    "IamRoleLambdaExecution": {
      "Type": "AWS::IAM::Role",
      "Properties": {
        "AssumeRolePolicyDocument": {
          "Version": "2012-10-17",
          "Statement": [
            {
              "Effect": "Allow",
              "Principal": {
                "Service": [
                  "lambda.amazonaws.com"
                ]
              },
              "Action": [
                "sts:AssumeRole"
              ]
            }
          ]
        },
        "Policies": [
          {
            "PolicyName": {
              "Fn::Join": [
                "-",
                [
                  "local",
                  "my-serverless-configuration-dev",
                  "lambda"
                ]
              ]
            },
            "PolicyDocument": {
              "Version": "2012-10-17",
              "Statement": [
                {
                  "Effect": "Allow",
                  "Action": [
                    "logs:CreateLogStream"
                  ],
                  "Resource": [
                    {
                      "Fn::Sub": "arn:${AWS::Partition}:logs:${AWS::Region}:${AWS::AccountId}:log-group:/aws/lambda/my-lambda-dev:*"
                    }
                  ]
                },
                {
                  "Effect": "Allow",
                  "Action": [
                    "logs:PutLogEvents"
                  ],
                  "Resource": [
                    {
                      "Fn::Sub": "arn:${AWS::Partition}:logs:${AWS::Region}:${AWS::AccountId}:log-group:/aws/lambda/my-lambda-dev:*:*"
                    }
                  ]
                },
                {
                  "Effect": "Allow",
                  "Action": [
                    "xray:PutTraceSegments",
                    "xray:PutTelemetryRecords"
                  ],
                  "Resource": [
                    "*"
                  ]
                },
                {
                  "Effect": "Allow",
                  "Action": [
                    "sqs:ReceiveMessage",
                    "sqs:DeleteMessage",
                    "sqs:GetQueueAttributes"
                  ],
                  "Resource": [
                    {
                      "Fn::GetAtt": [
                        "MySQS",
                        "Arn"
                      ]
                    }
                  ]
                }
              ]
            }
          }
        ],
        "Path": "/",
        "RoleName": {
          "Fn::Join": [
            "-",
            [
              "my-serverless-configuration-dev",
              "local",
              "us-east-1",
              "lambdaRole"
            ]
          ]
        }
      }
    },
    "MyDashlambdaLambdaFunction": {
      "Type": "AWS::Lambda::Function",
      "Properties": {
        "Code": {
          "S3Bucket": "my-s3-bucket",
          "S3Key": "serverless/my-serverless-configuration-dev/local/1557170222124-2019-05-06T19:17:02.124Z/my-serverless-configuration-dev.zip"
        },
        "FunctionName": "my-lambda-dev",
        "Handler": "index.handler",
        "MemorySize": 1024,
        "Role": {
          "Fn::GetAtt": [
            "IamRoleLambdaExecution",
            "Arn"
          ]
        },
        "Runtime": "nodejs8.10",
        "Timeout": 120,
        "TracingConfig": {
          "Mode": "Active"
        }
      },
      "DependsOn": [
        "MyDashlambdaLogGroup",
        "IamRoleLambdaExecution"
      ]
    },
    "MyDashlambdaLambdaVersionBbLDKGw3KsogfXrZn27dFQH7f9s4Gkw051me1ok": {
      "Type": "AWS::Lambda::Version",
      "DeletionPolicy": "Retain",
      "Properties": {
        "FunctionName": {
          "Ref": "MyDashlambdaLambdaFunction"
        },
        "CodeSha256": "H2xMJixZG3oB1HHwgElf6JPvdVaNT4WVEwZueSBp0Tk="
      }
    },
    "MyDashlambdaEventSourceMappingSQSMySQS": {
      "Type": "AWS::Lambda::EventSourceMapping",
      "DependsOn": "IamRoleLambdaExecution",
      "Properties": {
        "BatchSize": 1,
        "EventSourceArn": {
          "Fn::GetAtt": [
            "MySQS",
            "Arn"
          ]
        },
        "FunctionName": {
          "Fn::GetAtt": [
            "MyDashlambdaLambdaFunction",
            "Arn"
          ]
        },
        "Enabled": "True"
      }
    },
    "MySQS": {
      "Type": "AWS::SQS::Queue",
      "Properties": {
        "QueueName": "my-sqs-dev"
      }
    }
  },
  "Outputs": {
    "ServerlessDeploymentBucketName": {
      "Value": "my-s3-bucket"
    },
    "MyDashlambdaLambdaFunctionQualifiedArn": {
      "Description": "Current Lambda function version",
      "Value": {
        "Ref": "MyDashlambdaLambdaVersionBbLDKGw3KsogfXrZn27dFQH7f9s4Gkw051me1ok"
      }
    }
  }
}
```


Discussion:
The bug is in moto: https://github.com/spulec/moto/issues/2045.

Is this resolved?  Looks like the fix for moto #2045 was merged to master (PR #2376).
I'm still getting this error. Any updates on this?
I'm also getting this error.

Resolving patch:
diff --git a/localstack/services/cloudformation/cloudformation_starter.py b/localstack/services/cloudformation/cloudformation_starter.py
--- a/localstack/services/cloudformation/cloudformation_starter.py
+++ b/localstack/services/cloudformation/cloudformation_starter.py
@@ -462,6 +462,19 @@ def Lambda_create_from_cloudformation_json(cls, resource_name, cloudformation_js
     Lambda_create_from_cloudformation_json_orig = lambda_models.LambdaFunction.create_from_cloudformation_json
     lambda_models.LambdaFunction.create_from_cloudformation_json = Lambda_create_from_cloudformation_json
 
+    # Patch EventSourceMapping create_from_cloudformation_json(..) method in moto
+
+    @classmethod
+    def Mapping_create_from_cloudformation_json(cls, resource_name, cloudformation_json, region_name):
+        props = cloudformation_json.get('Properties', {})
+        func_name = props.get('FunctionName') or ''
+        if ':lambda:' in func_name:
+            props['FunctionName'] = aws_stack.lambda_function_name(func_name)
+        return Mapping_create_from_cloudformation_json_orig(resource_name, cloudformation_json, region_name)
+
+    Mapping_create_from_cloudformation_json_orig = lambda_models.EventSourceMapping.create_from_cloudformation_json
+    lambda_models.EventSourceMapping.create_from_cloudformation_json = Mapping_create_from_cloudformation_json
+
     # Patch LambdaFunction update_from_cloudformation_json(..) method in moto
 
     @classmethod


Test patch: