After performing these steps, zappa created a zip file for me namely artifact.zip(around 80 MB)
My AWS environment has some CI/CD setup, so i just need to upload this artifact.zip file into S3. Then CI/CD will take care of invoking API Gateway and lambda whenever i send HTTP Request.
Expected Behavior
whenever i send HTTP request, it needs to provide proper response
whenever my flask code is running, it needs to write the logging messages present in my flask application into cloudwatch as logs
Actual Behavior
Issue-1
whenever i send HTTP request, after 29 seconds, it is returning as Execution failed due to a timeout error
Note:
Based on my research, i found that API-Gateway has a time limit of 29 seconds. if API-Gateway didn't get any response from lambda with in 29 seconds, API Gateway returns timeout error
Based on my research, i found another information. If the lambda function is large in size, it will take more time to process.
After knowing these two points, i thought of reducing the size of my zip file. I gone to zipped file and noticed that, whenever i run zappa package dev -o artifact.zip , it is not only packaging my flask application codeit is also packaging misc(projects) which are available in upper level directory of my flask project
I tried using exclude option of zappa_settings.json but no success. i endup with 80MB zip file .
Here i want a way to only package my flask application code and requirments necessary for this application not other project codesWhen i send the HTTP request, i want proper response not timeout errors
Issue-2
when i see the cloudwatch logs of lambda function, i am seeing logging messages present in my flask application as print messages in cloudwatch not in the form of logs.
for example
Expected logging behaviour:
2020-11-01T15:31:43+0000 - DEBUG - - PROCESSING - START : processing started siva
Actual logging behaviour:
2020-11-01T15:31:43+0000 - - PROCESSING - START : processing started siva
if we see above example, i am seeing logging mesages present in my flask-application but there is no information about whether it is DEBUG,INFO OR ERROR etc.
Possible Fix
I don't have any idea.
Your Environment
Zappa version used: zappa 0.52.0
Operating System and Python version: Linux and Python 3.6
Context
I have a sample flask application that I want to deploy on the AWS environment(API-Gateway+Lambda) using Zappa. My project structure will be like this
zappa_settings.json file will be like this
My Requirements.txt file will be like this
i gone to
Backend/flask-project/
path and performed these stepsAfter performing these steps, zappa created a zip file for me namely
artifact.zip(around 80 MB)
My AWS environment has some CI/CD setup, so i just need to upload this
artifact.zip
file into S3. Then CI/CD will take care of invoking API Gateway and lambda whenever i send HTTP Request.Expected Behavior
my flask application
into cloudwatch as logsActual Behavior
Issue-1 whenever i send HTTP request, after 29 seconds, it is returning as
Execution failed due to a timeout error
Note:
timeout error
After knowing these two points, i thought of reducing the size of my zip file. I gone to
zipped file
and noticed that, whenever i runzappa package dev -o artifact.zip
, it is not only packagingmy flask application code
it is also packagingmisc(projects)
which are available in upper level directory of my flask projectI tried using
exclude
option ofzappa_settings.json
but no success. i endup with 80MB zip file .Here i want a way to only package my flask application code and requirments necessary for this application not other project codes When i send the HTTP request, i want proper response not timeout errors
Issue-2 when i see the cloudwatch logs of lambda function, i am seeing logging messages present in my
flask application
asprint
messages in cloudwatch not in the form of logs. for exampleif we see above example, i am seeing logging mesages present in my flask-application but there is no information about whether it is DEBUG,INFO OR ERROR etc.
Possible Fix
I don't have any idea.
Your Environment
pip freeze
:zappa_settings.json
:Can any one suggest a solution for this?