Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

/login page broken after upgrading to fastapi 0.70.0 #72

Closed
Yzoni opened this issue Oct 12, 2021 · 3 comments · Fixed by #75
Closed

/login page broken after upgrading to fastapi 0.70.0 #72

Yzoni opened this issue Oct 12, 2021 · 3 comments · Fixed by #75

Comments

@Yzoni
Copy link

Yzoni commented Oct 12, 2021

The login page templating seems to be broken with fastapi 0.70.0/Starlette 0.16.0.

2021-10-12 13:33:08,118 - uvicorn.access - INFO - 127.0.0.1:59355 - "GET /login HTTP/1.1" 500
2021-10-12 13:33:08,119 - uvicorn.error - ERROR - Exception in ASGI application
Traceback (most recent call last):
  File "/path/python3.9/site-packages/uvicorn/protocols/http/httptools_impl.py", line 375, in run_asgi
    result = await app(self.scope, self.receive, self.send)
  File "/path/python3.9/site-packages/uvicorn/middleware/proxy_headers.py", line 75, in __call__
    return await self.app(scope, receive, send)
  File "/path/python3.9/site-packages/fastapi/applications.py", line 208, in __call__
    await super().__call__(scope, receive, send)
  File "/path/python3.9/site-packages/starlette/applications.py", line 112, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/path/python3.9/site-packages/starlette/middleware/errors.py", line 181, in __call__
    raise exc
  File "/path/python3.9/site-packages/starlette/middleware/errors.py", line 159, in __call__
    await self.app(scope, receive, _send)
  File "/path/python3.9/site-packages/starlette/middleware/sessions.py", line 77, in __call__
    await self.app(scope, receive, send_wrapper)
  File "/path/python3.9/site-packages/starlette/middleware/authentication.py", line 48, in __call__
    await self.app(scope, receive, send)
  File "/path/python3.9/site-packages/starlette_context/middleware/raw_middleware.py", line 96, in __call__
    await self.app(scope, receive, send_wrapper)
  File "/path/python3.9/site-packages/starlette/middleware/cors.py", line 84, in __call__
    await self.app(scope, receive, send)
  File "/path/python3.9/site-packages/starlette/exceptions.py", line 82, in __call__
    raise exc
  File "/path/python3.9/site-packages/starlette/exceptions.py", line 71, in __call__
    await self.app(scope, receive, sender)
  File "/path/python3.9/site-packages/starlette/routing.py", line 656, in __call__
    await route.handle(scope, receive, send)
  File "/path/python3.9/site-packages/starlette/routing.py", line 259, in handle
    await self.app(scope, receive, send)
  File "/path/python3.9/site-packages/starlette/routing.py", line 61, in app
    response = await func(request)
  File "/path/python3.9/site-packages/fastapi_aad_auth/ui/__init__.py", line 123, in login
    return self._login(request)
  File "/path/python3.9/site-packages/fastapi_aad_auth/ui/__init__.py", line 64, in _login
    return self.login_templates.TemplateResponse(self.login_template_path.name, context)  # type: ignore
  File "/path/python3.9/site-packages/starlette/templating.py", line 87, in TemplateResponse
    return _TemplateResponse(
  File "/path/python3.9/site-packages/starlette/templating.py", line 33, in __init__
    content = template.render(context)
  File "/path/python3.9/site-packages/jinja2/environment.py", line 1304, in render
    self.environment.handle_exception()
  File "/path/python3.9/site-packages/jinja2/environment.py", line 925, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "/path/python3.9/site-packages/fastapi_aad_auth/ui/login.html", line 1, in top-level template code
    {% extends "fastapi_aad_auth.ui:base.html" %}
  File "/path/python3.9/site-packages/jinja2/loaders.py", line 214, in get_source
    raise TemplateNotFound(template)
jinja2.exceptions.TemplateNotFound: fastapi_aad_auth.ui:base.html
@nickroci
Copy link

+1 on this weird thing is I can't repo it on windows only Linux

@nickroci
Copy link

FYI they renamed get_env to _create_env in starlette jinja2templates which breaks the overridden stuff in the jinja.py. Can't raise a pr for it atm

@robintw
Copy link
Contributor

robintw commented Feb 25, 2022

I've just run into this problem too. For me, pinning fastapi to v0.69.0 solved the problem temporarily. If anyone is able to do a more permanent fix then that'd be great.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants