def lambda_handler()

in lambda/kinesis_stream/app.py [0:0]


def lambda_handler(event, context):

    logger.info(event)

    for record in event['Records']:
        item = json.loads(base64.b64decode(record['kinesis']['data']))

        # Return and report the failed record as soon as we encounter a problem
        if 'error' in item['id']:
            logger.error(item)
            return {"batchItemFailures":[{"itemIdentifier": record["kinesis"]["sequenceNumber"]}]}

    return