zappa / Zappa

Serverless Python
https://zappa.ws/zappa
MIT License
3.25k stars 363 forks source link

[Migrated] Firehose events not supported. #619

Closed jneves closed 5 months ago

jneves commented 3 years ago

Originally from: https://github.com/Miserlou/Zappa/issues/1580 by oryonatan

Zappa can't process Kinesis Firehose events.

Context

On Python 2.7, the handler tries to find 'Records' inside events, this field is not available in Kinesis Firehose events, as those use the lower case form 'records'. Moreover, in Kinesis Firehose events, the ARN appears in the top level event, and not in the record.

Possible Fix

see https://github.com/oryonatan/Zappa/commit/53d3a0f16b1a173d1704db0d8cc6be31a9652882 add to handler.py:420

        # This is a Kinesis Firehose event.
        elif event.get('records', None):
            records = event.get('records')
            result = None
            arn = event.get("sourceKinesisStreamArn")
            whole_function = self.settings.AWS_EVENT_MAPPING.get(arn)
            if whole_function:
                app_function = self.import_module_and_get_function(whole_function)
                result = self.run_function(app_function, event, context)
                logger.debug(result)
            else:
                logger.error("Cannot find a function to process the triggered firehose event.")
            return result
github-actions[bot] commented 5 months ago

Hi there! Unfortunately, this Issue has not seen any activity for at least 90 days. If the Issue is still relevant to the latest version of Zappa, please comment within the next 10 days if you wish to keep it open. Otherwise, it will be automatically closed.

github-actions[bot] commented 5 months ago

Hi there! Unfortunately, this Issue was automatically closed as it had not seen any activity in at least 100 days. If the Issue is still relevant to the latest version of Zappa, please open a new Issue.