simonw / datasette-search-all

Datasette plugin for searching all searchable tables at once
Apache License 2.0
19 stars 4 forks source link

Fix bug with Datasette 0.45 and ASGI lifespan #8

Closed simonw closed 4 years ago

simonw commented 4 years ago

Originally posted by @simonw in https://github.com/dogsheep/github-to-sqlite/issues/41#issuecomment-653962708

simonw commented 4 years ago

Yup that's a bug:

% datasette .
INFO:     Started server process [733]
INFO:     Waiting for application startup.
ERROR:    Exception in 'lifespan' protocol
Traceback (most recent call last):
  File "/Users/simon/.local/share/virtualenvs/datasette-search-all-2uhSNKR0/lib/python3.7/site-packages/uvicorn/lifespan/on.py", line 48, in main
    await app(scope, self.receive, self.send)
  File "/Users/simon/.local/share/virtualenvs/datasette-search-all-2uhSNKR0/lib/python3.7/site-packages/uvicorn/middleware/proxy_headers.py", line 45, in __call__
    return await self.app(scope, receive, send)
  File "/Users/simon/Dropbox/Development/datasette-search-all/datasette_search_all/__init__.py", line 22, in wrapped_app
    path = scope["path"]
KeyError: 'path'
ERROR:    Application startup failed. Exiting.

Root cause is https://github.com/simonw/datasette/commit/16f592247a2a0e140ada487e9972645406dcae69

simonw commented 4 years ago

Cleanest fix is to switch to using the register_routes plugin hook.