CloudWatch events triggering lambda functions are not being handled by Zappa. The events contain a json with the following format: {'awslogs': {'data': 'Dmt.....EA'}} which fails to match any of the conditions in the LambdaHandler.handler function.
Context
When configuring CloudWatch to trigger a Lambda function deployed by Zappa, I can see Zappa receiving the event and calling LambdaHandler.handler():
START RequestId: 850...e9a Version: $LATEST
Instancing..
[DEBUG] 2019-08-30T18:02:42.685Z 850...e9a Zappa Event: {'awslogs': {'data': 'H4sIA...AAA='}}
END RequestId: 850...e9a
REPORT RequestId: 850...e9a Duration: 2.53 ms Billed Duration: 100 ms Memory Size: 512 MB Max Memory Used: 67 MB
but my configured handler function is not called.
Expected Behavior
My configured function in zappa_settings.json should be executed π
Actual Behavior
My function is not executed β
Possible Fix
Add a new if condition in the handler function to look for the awslogs key in the event object/dict and trigger the configured handler function.
Steps to Reproduce
Create and deploy a lambda function with Zappa. Add a simple print statement in the handler to confirm that the function is triggered.
Create a CloudWatch log subscription filter that triggers the lambda function (see here)
Push data to the log that triggers the subscription filter: aws logs put-subscription-filter \ --log-group-name myLogGroup \ --filter-name demo \ --filter-pattern "" \ --destination-arn arn:aws:lambda:region:123456789123:function:helloworld
The lambda function will be executed, but the handler function will not.
CloudWatch events triggering lambda functions are not being handled by Zappa. The events contain a json with the following format:
{'awslogs': {'data': 'Dmt.....EA'}}
which fails to match any of the conditions in the LambdaHandler.handler function.Context
When configuring CloudWatch to trigger a Lambda function deployed by Zappa, I can see Zappa receiving the event and calling
LambdaHandler.handler()
:but my configured handler function is not called.
Expected Behavior
My configured function in
zappa_settings.json
should be executed πActual Behavior
My function is not executed β
Possible Fix
Add a new if condition in the handler function to look for the
awslogs
key in the event object/dict and trigger the configured handler function.Steps to Reproduce
aws logs put-subscription-filter \ --log-group-name myLogGroup \ --filter-name demo \ --filter-pattern "" \ --destination-arn arn:aws:lambda:region:123456789123:function:helloworld
Your Environment
pip freeze
:zappa_settings.py
: