Hi there,
I’m building a basic webapp in Flask, that’s deployed with Serverless and lives on AWS Lambda. Locally, the app works perfectly. When I deploy it to Lambda behind a custom domain, I’m getting an ‘Internat Server Error’, and when I look into the logs, I see the following environment variable is missing:
lambda_runtime_api_addr = os.environ['AWS_LAMBDA_RUNTIME_API']
KeyError: 'AWS_LAMBDA_RUNTIME_API'
File "/var/task/wsgi_handler.py", line 49, in import_app
raise Exception("Unable to import
{}
".format(config["app"]))
The WSGI part of my configuration is:
custom:
wsgi:
app: <PACKAGE>.start_app.app
# packRequirements: false
pythonRequirements:
dockerizePip: non-linux
customDomain:
domainName: <DOMAIN>
basePath: ${opt:stage, env:STAGE, 'development'}
stage: ${opt:stage, env:STAGE, 'development'}
createRoute53Record: true
certificateName: <CERTIFICATE NAME>
functions:
app:
handler: wsgi_handler.handler
events:
- http: ANY /
- http: 'ANY {proxy+}'
plugins:
- serverless-python-requirements
- serverless-wsgi
- serverless-domain-manager
Searching for the name of the missing variable brings up nothing online, so I’m unsure whether or not this is actually breaking the application, and it’s just failing at importing the app instead. Does anyone have any guidance?