question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

FastAPI incompatibility

See original GitHub issue

Context

I get a 500 response code when I try to deploy a simple application.

from fastapi import FastAPI

app = FastAPI()

@app.get("/")
def read_root():
    return {"Hello": "World"}

Zappa tail says [1562665728357] __call__() missing 1 required positional argument: 'send'.

When I go to the api gateway url, I see this message:

“{‘message’: ‘An uncaught exception happened while servicing this request. You can investigate this with the zappa tail command.’, ‘traceback’: [‘Traceback (most recent call last):\n’, ’ File "/var/task/handler.py", line 531, in handler\n with Response.from_app(self.wsgi_app, environ) as response:\n’, ’ File "/var/task/werkzeug/wrappers/base_response.py", line 287, in from_app\n return cls(*_run_wsgi_app(app, environ, buffered))\n’, ’ File "/var/task/werkzeug/test.py", line 1119, in run_wsgi_app\n app_rv = app(environ, start_response)\n’, ’ File "/var/task/zappa/middleware.py", line 70, in call\n response = self.application(environ, encode_response)\n’, "TypeError: call() missing 1 required positional argument: ‘send’\n"]}”

Steps to Reproduce

zappa init
zappa deploy dev
# Error: Warning! Status check on the deployed lambda failed. A GET request to '/' yielded a 500 response code.

Your Environment

  • Zappa version used: 0.48.2
  • Operating System and Python version: macOS Mojave | Python 3.6.5
  • The output of pip freeze:
Package             Version  
------------------- ---------
aiofiles            0.4.0    
aniso8601           6.0.0    
argcomplete         1.9.3    
boto3               1.9.184  
botocore            1.12.184 
certifi             2019.6.16
cfn-flip            1.2.1    
chardet             3.0.4    
Click               7.0      
dataclasses         0.6      
dnspython           1.16.0   
docutils            0.14     
durationpy          0.5      
email-validator     1.0.4    
fastapi             0.31.0   
future              0.16.0   
graphene            2.1.6    
graphql-core        2.2      
graphql-relay       0.4.5    
h11                 0.8.1    
hjson               3.0.1    
httptools           0.0.13   
idna                2.8      
itsdangerous        1.1.0    
Jinja2              2.10.1   
jmespath            0.9.3    
kappa               0.6.0    
lambda-packages     0.20.0   
MarkupSafe          1.1.1    
pip                 19.1.1   
placebo             0.9.0    
promise             2.2.1    
pydantic            0.29     
python-dateutil     2.6.1    
python-multipart    0.0.5    
python-slugify      1.2.4    
PyYAML              5.1.1    
requests            2.22.0   
Rx                  1.6.1    
s3transfer          0.2.1    
setuptools          39.0.1   
six                 1.12.0   
starlette           0.12.0   
toml                0.10.0   
tqdm                4.19.1   
troposphere         2.4.9    
ujson               1.35     
Unidecode           1.1.1    
urllib3             1.25.3   
uvicorn             0.8.3    
uvloop              0.12.2   
websockets          7.0      
Werkzeug            0.15.4   
wheel               0.33.4   
wsgi-request-logger 0.4.6    
zappa               0.48.2
  • Your zappa_settings.py:
{
    "dev": {
        "app_function": "app.main.app",
        "aws_region": "ap-northeast-2",
        "profile_name": "default",
        "project_name": "myprojectname",
        "runtime": "python3.6",
        "s3_bucket": "mybucketname"
    }
}

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:4
  • Comments:11

github_iconTop GitHub Comments

7reactions
danielloadercommented, Sep 9, 2019

Has anyone got a zappa deployment working with with FastAPI yet?

1reaction
delijaticommented, Feb 9, 2020

I got ASGI running on lambda with magnum here is the code https://github.com/Miserlou/Zappa/issues/649#issuecomment-491625763

Read more comments on GitHub >

github_iconTop Results From Across the Web

Dependencies - First Steps - FastAPI - tiangolo
FastAPI compatibility ¶. The simplicity of the dependency injection system makes FastAPI compatible with: all the relational databases; NoSQL databases ...
Read more >
Compatibility — Schemathesis 3.17.5 documentation
FastAPI uses pydantic for JSON Schema generation, and it produces Draft 7 compatible schemas. But Open API 2 / 3.0.x use earlier versions...
Read more >
fastapi - PyPI
FastAPI is a modern, fast (high-performance), web framework for building APIs with Python 3.7+ based on standard Python type hints. The key features...
Read more >
FastAPI - The Good, the Bad and the Ugly - Infolytx
FastAPI is a relatively new web framework for Python. ... like a serverless environment, Django's high first call and startup time might become...
Read more >
Pycharm - FastAPI issue with static files - Stack Overflow
I am struggling to reference my static css files in my template index.html file. In my head tag in index.html I have:
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found