Hi All,
I am new to serverless and I was using serverless to deploy a python flask application to AWS Lambda function with following instruction: https://serverless.com/blog/flask-python-rest-api-serverless-lambda-dynamodb/#converting-an-existing-flask-application. However I was getting following error
{ "errorMessage":"Unable to import application.application", "errorType":"Exception", "stackTrace":[ " File \"/var/lang/lib/python3.7/imp.py\", line 234, in load_module\n return load_source(name, filename, file)\n", " File \"/var/lang/lib/python3.7/imp.py\", line 171, in load_source\n module = _load(spec)\n", " File \"<frozen importlib._bootstrap>\", line 696, in _load\n", " File \"<frozen importlib._bootstrap>\", line 677, in _load_unlocked\n", " File \"<frozen importlib._bootstrap_external>\", line 728, in exec_module\n", " File \"<frozen importlib._bootstrap>\", line 219, in _call_with_frames_removed\n", " File \"/var/task/wsgi.py\", line 105, in <module>\n wsgi_app = import_app(config)\n", " File \"/var/task/wsgi.py\", line 49, in import_app\n raise Exception(\"Unable to import {}\".format(config[\"app\"]))\n" ] }
There is the serverless.yml file:
service: chromeagentapiservices
plugins:
- serverless-python-requirements
- serverless-wsgi
custom:
wsgi:
app: application.application
packRequirements: false
pythonRequirements:
dockerizePip: non-linux
provider:
name: aws
runtime: python3.7
stage: dev
region: ap-southeast-2
service: execute-api
functions:
app:
handler: wsgi.handler
environment:
AppId: A string here
Chrome_DB: another string here
events:
- http: ANY /
- https: 'ANY{proxy+}'
Did I configure it correctly? Why does this issue happens?
FYI, I was building the app on Ubuntu