# Missing AWS\_LAMBDA\_RUNTIME\_API in Serverless Flask/Lambda

**URL:** <https://forum.serverless.com/t/missing-aws-lambda-runtime-api-in-serverless-flask-lambda/8024>\
**Category:** Serverless Framework\
**Tags:** aws, lambda, api-gateway\
**Created:** [April 18, 2019, 9:46am UTC](https://forum.serverless.com/t/missing-aws-lambda-runtime-api-in-serverless-flask-lambda/8024 "2019-04-18T09:46:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tonyfresko](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/tonyfresko/32/3263_2.png) [@tonyfresko](https://forum.serverless.com/u/tonyfresko)\
**Post date:** [April 18, 2019, 9:46am UTC](https://forum.serverless.com/t/missing-aws-lambda-runtime-api-in-serverless-flask-lambda/8024/1 "2019-04-18T09:46:32Z")

</div>

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'`

```auto
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:

```auto
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?

---

<div class="post-metadata">

**Author:** ![kfranzenCC](https://avatars.discourse-cdn.com/v4/letter/k/48db29/32.png) [@kfranzenCC](https://forum.serverless.com/u/kfranzenCC)\
**Post date:** [July 14, 2020, 11:49pm UTC](https://forum.serverless.com/t/missing-aws-lambda-runtime-api-in-serverless-flask-lambda/8024/2 "2020-07-14T23:49:27Z")

</div>

I am hitting this now. Curious if anyone ever answered or if it was resolved?
