epsagon-python icon indicating copy to clipboard operation
epsagon-python copied to clipboard

FastAPI Issue

Open eyalabadi98 opened this issue 2 years ago • 3 comments

After installing epsagon on my FastAPI application, I get the following error: (route) got an unexpected keyword argument 'epsagon_request'

My configuration is pretty straight forward:

epsagon.init( token='token, app_name='my-app', metadata_only=False, )

eyalabadi98 avatar Oct 02 '22 22:10 eyalabadi98

Hi @eyalabadi98, can you share your fastapi version? It would also be helpful if you got a reproducible.

ranrib avatar Oct 03 '22 07:10 ranrib

Hi @ranrib ,

This example causes the issue:

from fastapi import FastAPI
from fastapi.exceptions import RequestValidationError
from starlette.exceptions import HTTPException
from starlette.middleware.cors import CORSMiddleware
import uvicorn

import epsagon

epsagon.init(
    token='Test',
    app_name='Test',
    metadata_only=False,
)

app = FastAPI()

@app.get("/")
async def root():
    return {"message": "Hello World"}


def start():
    """Launched with `poetry run start` at root level"""
    uvicorn.run("main:app", host="0.0.0.0", port=8000, reload=True)

Versions:

python = "^3.9" epsagon = "^1.81.0" fastapi = "^0.85.0" uvicorn = "^0.18.3"

eyalabadi98 avatar Oct 03 '22 15:10 eyalabadi98

Hi, please add the following env var: EPSAGON_FASTAPI_ASYNC_MODE=TRUE This should solve the issue

ranrib avatar Oct 06 '22 07:10 ranrib