Skip to content

ASGI Lifespan errored in Litestar #356

Answered by gi0baro
winstxnhdw asked this question in Q&A
Discussion options

You must be logged in to vote

I should probably review the logging for lifespan, as if the application won't return a lifespan error but just throw an exception, then Granian consider it as unsupported and avoid to log the actual exception – several people complained by log pollution in the past.

There's definitely something going on in the litestar app during lifespan startup, but In order to retrieve the error, you should copy the ASGI spawn method from here https://github.com/emmett-framework/granian/blob/master/granian/server.py#L216-L275, edit the line

if lifespan_handler.interrupt:

and change it to

if lifespan_handler.exc:

So you can pass it to the Granian.serve method as follows:

Granian(...).serve(spawn_target=y…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by winstxnhdw
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants