Closed wihlarkop closed 11 months ago
I believe this is because Granian doesn't have lifespan support yet.
@wihlarkop @ameyer117 yep I suppose this needs #94, but I didn't check if the lifespan
parameter of starlette (and thus FastAPI) requires that. Probably someone like @Kludex can confirm this.
The OP is not pointing out what is the error on the server side...
I think Starlette warns if the server doesn't support lifespan state. I would need to confirm (I'm afk).
Hi @Kludex
there is no log or error when i start the server, when i access 127.0.0.1:8000 it just blank page like my ss and in cli there is no error or warning too, even when i add log_enabled=True in granian still no error log
@ameyer117 it can work with your solution , but on_event workaround will deprecated so i want to migrate to lifespan event handlers
Does granian log error if startup has errors?
@Kludex in my case granian just give log like this
[INFO] Starting granian
[INFO] Listening at: 127.0.0.1:8000
[INFO] Spawning worker-1 with pid: 10501
if you want try my code you can access this https://github.com/wihlarkop/fastapi-granian
Hey all, I debugged this locally.
So there are two themes here:
The actual issue here is that Granian is actually catching the exception and exiting the worker process without logging or re-raising anything, and since there's no fine-grained process management today in granian, the main process is kept alive even if the actual worker prematurely exited (this is a theme also in #148 ).
So in conclusion:
i got this issue when running granian with fastapi, server is running but can't open/blank in browser
my requirements.txt
this is my main.py file
and i run
python main.py