Hello, Thank you for your product, it’s amazing h...
# support-questions-legacy
t
Hello, Thank you for your product, it’s amazing how simple and comfortable it is to set up and use. Your work is breathtaking 🙂 But there’s one issue I ran into. Can you help? I’ve set up supertokens-python on FastAPI(0.95.1), and now I keep getting exceptions:
h11._util.LocalProtocolError: Can't send data when our state is ERROR
It seems that the root cause for it is inheritance from Starlette's BaseHTTPMiddleware https://github.com/encode/uvicorn/issues/111 https://github.com/encode/starlette/issues/1678 Can you help me in rewriting your middleware so it doesn’t use BaseHTTPMiddleware? Specifically, I have no idea what to do with
Copy code
python
if result is None:
    response = await call_next(request)
r
hey @The Lower Depths
So the default middleware is not working for you as is? Are you doing something custom somewhere?
t
Actually yes, I'm using third party email password recipe, and overridden it a bit, but it doesn't look like it is the issue. I started to have this exception after installing supertokens and googling says this error is Starlette's fault. Now I'm wondering can I write your middleware without problematic element as pure ASGI middleware
r
> I started to have this exception after installing supertokens So this is some issue caused by our SDK then?
I think our boilerplate app using
npx create-supertokens-app@latest
with FastAPI works. Have you tried that?
t
Oh, I'm sorry, haven't mentioned, it occurs only in unknown circumstances, I have it only in logs of my app. Probably it happens when app is under high pressure
r
ahh i see
t
Normally everything works fine
r
is there a way to reproduce it? Maybe we can fix it..
t
I have no idea how my users do this. It's their own black magic
I have a traceback though
r
that would be helpful
> Specifically, I have no idea what to do with > if result is None: > response = await call_next(request) This means that if our middleware didn't handle the request, forward the request to your apis / middleware.
r
maybe open an issue about this on our github in the python repo. So that it doesn't get lost
t
Ok, I'll do it, though its issues section looks a bit deserted
Anyway, thank you for your help 🙂
r
if you can shed some light on how we can reproduce it, that would go a long way to help us fixing this.
57 Views