garnaat / kappa

What precedes Lambda
http://kappa.readthedocs.org/en/develop/
Apache License 2.0
902 stars 89 forks source link

Kinesis Event Source add function not working as expected #119

Open olabhrad opened 7 years ago

olabhrad commented 7 years ago

The Kinesis Event Source add function is not working as expected. When deploying the first time the function works fine. On subsequent deployments the exception is thrown:

-> Unable to add event source Traceback (most recent call last): File "/Library/Python/2.7/site-packages/kappa/event_source/kinesis.py", line 49, in add Enabled=self.enabled File "/Library/Python/2.7/site-packages/kappa/awsclient.py", line 86, in call data = op(**kwargs) File "/Library/Python/2.7/site-packages/botocore/client.py", line 253, in _api_call return self._make_api_call(operation_name, kwargs) File "/Library/Python/2.7/site-packages/botocore/client.py", line 557, in _make_api_call raise error_class(parsed_response, operation_name) ResourceConflictException: An error occurred (ResourceConflictException) when calling the CreateEventSourceMapping operation: The event source arn (<arn>) and function (<function>) provided mapping already exists. Please update or delete the existing mapping with UUID <UUID> done

This can be avoided by checking to see if the mapping exists first (list_event_source_mappings) and then calling either create_event_source_mapping or update_event_source_mapping based on the response.

olabhrad commented 7 years ago

PR: https://github.com/garnaat/kappa/pull/120