Some ASGI servers, such as uvicorn, will sometimes pass a scope object to WsgiToAsgi where scope["server"] is set to None. This causes the app to crash when build_environ tries to access scope["server"] like a tuple (here).
However, extending the check to include that scope["server"] is not None would be an imperfect fix, because it would set SERVER_NAME and SERVER_PORT to "localhost:80" when in some cases that's not true - for example, when launching uvicorn bound to a Unix socket. This latter issue likely needs to be fixed in the server code, though.
Some ASGI servers, such as
uvicorn, will sometimes pass ascopeobject toWsgiToAsgiwherescope["server"]is set to None. This causes the app to crash whenbuild_environtries to accessscope["server"]like a tuple (here).However, extending the check to include that
scope["server"]is not None would be an imperfect fix, because it would setSERVER_NAMEandSERVER_PORTto"localhost:80"when in some cases that's not true - for example, when launchinguvicornbound to a Unix socket. This latter issue likely needs to be fixed in the server code, though.