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

KeyError when visiting api #227

Closed
Ruriko opened this issue Feb 14, 2022 · 3 comments
Closed

KeyError when visiting api #227

Ruriko opened this issue Feb 14, 2022 · 3 comments

Comments

@Ruriko
Copy link

Ruriko commented Feb 14, 2022

I install the script on my new server but when I try to visit the site I get this error:
{"url": "http://xxx.xxx.xxx.xxx:8080/", "time": "2022-02-14T10:03:28.581632", "code": 500, "detail": "KeyError", "trace": "77CA06DB9746841B", "headers": {}}

I also tried deploying on heroku and I get that same error. How to fix this error for my server?

@mnixry
Copy link
Member

mnixry commented Feb 14, 2022

log and exception detail please

@Ruriko
Copy link
Author

Ruriko commented Feb 14, 2022

where is the log located?

@Ruriko
Copy link
Author

Ruriko commented Feb 14, 2022

Nvm I found where the logs are so here's the error log:

2022-02-14 11:16:45.821 | WARNING  | hibiapi.__main__:main:79 -                                                                                                                                                                                                                                        
                                                                                                    _    _ _ _     _          _____ _____                                                                                                    
                                                                                                   | |  | (_) |   (_)   /\   |  __ \_   _|                                                                                                   
                                                                                                   | |__| |_| |__  _   /  \  | |__) || |                                                                                                     
                                                                                                   |  __  | | '_ \| | / /\ \ |  ___/ | |                                                                                                     
                                                                                                   | |  | | | |_) | |/ ____ \| |    _| |_                                                                                                    
                                                                                                   |_|  |_|_|_.__/|_/_/    \_\_|   |_____|                                                                                                   
                                                                                                                                                                                                                                      
                                                                               A program that implements easy-to-use APIs for a variety of commonly used sites                                                                               
                                                                                                Repository: https://github.com/mixmoe/HibiAPI                                                                                                
                                                                                                                                                                                                                                     
2022-02-14 11:16:45.823 | INFO     | hibiapi.__main__:main:82 - HibiAPI version: 0.7.6
2022-02-14 11:16:45.823 | INFO     | hibiapi.__main__:main:83 - Server is running under production mode!
2022-02-14 11:16:45.824 | WARNING  | uvicorn.config:__init__:298 - Current configuration will not reload as not all conditions are met,please refer to documentation.
2022-02-14 11:16:46.334 | WARNING  | hibiapi.app.routes.sauce:<module>:17 - Sauce API key not set, SauceNAO endpoint will be unavailable
2022-02-14 11:16:46.415 | WARNING  | hibiapi.app.routes:<module>:37 - API Route /sauce has been disabled in config.
2022-02-14 11:16:46.511 | INFO     | uvicorn.server:serve:75 - Started server process [2035]
2022-02-14 11:16:46.512 | INFO     | uvicorn.lifespan.on:startup:45 - Waiting for application startup.
2022-02-14 11:16:46.512 | INFO     | uvicorn.lifespan.on:main:92 - ASGI 'lifespan' protocol appears unsupported.
2022-02-14 11:16:46.513 | INFO     | uvicorn.lifespan.on:startup:59 - Application startup complete.
2022-02-14 11:16:46.514 | INFO     | uvicorn.server:_log_started_message:206 - Uvicorn running on http://xxx.xxx.xxx.xxx:8080 (Press CTRL+C to quit)
2022-02-14 11:16:53.715 | ERROR    | hibiapi.app.handlers:exception_handler:21 - Uncaught exception raised exc.data=ExceptionReturn(url=None, time=datetime.datetime(2022, 2, 14, 11, 16, 53, 713733), code=500, detail='KeyError', trace='A113A5709B598133', headers={}):
Traceback (most recent call last):

  File "/var/www/api.zettai.moe/htdocs/mypython/lib/python3.8/site-packages/anyio/streams/memory.py", line 81, in receive
    return self.receive_nowait()
           │    └ <function MemoryObjectReceiveStream.receive_nowait at 0x7f8a97d1fca0>
           └ MemoryObjectReceiveStream(_state=MemoryObjectStreamState(max_buffer_size=0, buffer=deque([]), open_send_channels=0, open_rece...
  File "/var/www/api.zettai.moe/htdocs/mypython/lib/python3.8/site-packages/anyio/streams/memory.py", line 76, in receive_nowait
    raise WouldBlock
          └ <class 'anyio.WouldBlock'>

anyio.WouldBlock


During handling of the above exception, another exception occurred:


Traceback (most recent call last):

  File "/var/www/api.zettai.moe/htdocs/mypython/lib/python3.8/site-packages/starlette/middleware/base.py", line 41, in call_next
    message = await recv_stream.receive()
                    │           └ <function MemoryObjectReceiveStream.receive at 0x7f8a97d1fd30>
                    └ MemoryObjectReceiveStream(_state=MemoryObjectStreamState(max_buffer_size=0, buffer=deque([]), open_send_channels=0, open_rece...
  File "/var/www/api.zettai.moe/htdocs/mypython/lib/python3.8/site-packages/anyio/streams/memory.py", line 101, in receive
    raise EndOfStream
          └ <class 'anyio.EndOfStream'>

anyio.EndOfStream


During handling of the above exception, another exception occurred:


Traceback (most recent call last):

  File "/var/www/api.zettai.moe/htdocs/mypython/bin/hibiapi", line 8, in <module>
    sys.exit(main())
    │   │    └ <Command HibiAPI>
    │   └ <built-in function exit>
    └ <module 'sys' (built-in)>
  File "/var/www/api.zettai.moe/htdocs/mypython/lib/python3.8/site-packages/click/core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
           │    │     │       └ {}
           │    │     └ ()
           │    └ <function BaseCommand.main at 0x7f8a9e73c280>
           └ <Command HibiAPI>
  File "/var/www/api.zettai.moe/htdocs/mypython/lib/python3.8/site-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
         │    │      └ <click.core.Context object at 0x7f8a9e981fd0>
         │    └ <function Command.invoke at 0x7f8a9e5cff70>
         └ <Command HibiAPI>
  File "/var/www/api.zettai.moe/htdocs/mypython/lib/python3.8/site-packages/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           │   │      │    │           │   └ {'host': 'xxx.xxx.xxx.xxx', 'port': 8080, 'workers': 1, 'reload': False}
           │   │      │    │           └ <click.core.Context object at 0x7f8a9e981fd0>
           │   │      │    └ <function main at 0x7f8a9d1344c0>
           │   │      └ <Command HibiAPI>
           │   └ <function Context.invoke at 0x7f8a9e73ca60>
           └ <click.core.Context object at 0x7f8a9e981fd0>
  File "/var/www/api.zettai.moe/htdocs/mypython/lib/python3.8/site-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
                       │       └ {'host': 'xxx.xxx.xxx.xxx', 'port': 8080, 'workers': 1, 'reload': False}
                       └ ()
  File "/var/www/api.zettai.moe/htdocs/mypython/lib/python3.8/site-packages/hibiapi/__main__.py", line 87, in main
    uvicorn.run(
    │       └ <function run at 0x7f8a9dc178b0>
    └ <module 'uvicorn' from '/var/www/api.zettai.moe/htdocs/mypython/lib/python3.8/site-packages/uvicorn/__init__.py'>
  File "/var/www/api.zettai.moe/htdocs/mypython/lib/python3.8/site-packages/uvicorn/main.py", line 461, in run
    server.run()
    │      └ <function Server.run at 0x7f8a9dc173a0>
    └ <uvicorn.server.Server object at 0x7f8a9d127790>
  File "/var/www/api.zettai.moe/htdocs/mypython/lib/python3.8/site-packages/uvicorn/server.py", line 60, in run
    return asyncio.run(self.serve(sockets=sockets))
           │       │   │    │             └ None
           │       │   │    └ <function Server.serve at 0x7f8a9dc17430>
           │       │   └ <uvicorn.server.Server object at 0x7f8a9d127790>
           │       └ <function run at 0x7f8a9e5ec820>
           └ <module 'asyncio' from '/usr/lib/python3.8/asyncio/__init__.py'>
  File "/usr/lib/python3.8/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
           │    │                  └ <coroutine object Server.serve at 0x7f8a9d126ac0>
           │    └ <method 'run_until_complete' of 'uvloop.loop.Loop' objects>
           └ <uvloop.Loop running=True closed=False debug=False>
  File "/var/www/api.zettai.moe/htdocs/mypython/lib/python3.8/site-packages/uvicorn/protocols/http/httptools_impl.py", line 367, in run_asgi
    result = await app(self.scope, self.receive, self.send)
                   │   │    │      │    │        │    └ <function RequestResponseCycle.send at 0x7f8a9c4f7040>
                   │   │    │      │    │        └ <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7f8a939ab8e0>
                   │   │    │      │    └ <function RequestResponseCycle.receive at 0x7f8a9c4f70d0>
                   │   │    │      └ <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7f8a939ab8e0>
                   │   │    └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('xxx.xxx.xxx.xxx', 8080...
                   │   └ <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7f8a939ab8e0>
                   └ <uvicorn.middleware.proxy_headers.ProxyHeadersMiddleware object at 0x7f8a9d135f70>
  File "/var/www/api.zettai.moe/htdocs/mypython/lib/python3.8/site-packages/uvicorn/middleware/proxy_headers.py", line 75, in __call__
    return await self.app(scope, receive, send)
                 │    │   │      │        └ <bound method RequestResponseCycle.send of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7f8a939ab8...
                 │    │   │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7f8a939...
                 │    │   └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('xxx.xxx.xxx.xxx', 8080...
                 │    └ <fastapi.applications.FastAPI object at 0x7f8a93aee7f0>
                 └ <uvicorn.middleware.proxy_headers.ProxyHeadersMiddleware object at 0x7f8a9d135f70>
  File "/var/www/api.zettai.moe/htdocs/mypython/lib/python3.8/site-packages/fastapi/applications.py", line 208, in __call__
    await super().__call__(scope, receive, send)
                           │      │        └ <bound method RequestResponseCycle.send of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7f8a939ab8...
                           │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7f8a939...
                           └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('xxx.xxx.xxx.xxx', 8080...
  File "/var/www/api.zettai.moe/htdocs/mypython/lib/python3.8/site-packages/starlette/applications.py", line 112, in __call__
    await self.middleware_stack(scope, receive, send)
          │    │                │      │        └ <bound method RequestResponseCycle.send of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7f8a939ab8...
          │    │                │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7f8a939...
          │    │                └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('xxx.xxx.xxx.xxx', 8080...
          │    └ <starlette.middleware.errors.ServerErrorMiddleware object at 0x7f8a939abbb0>
          └ <fastapi.applications.FastAPI object at 0x7f8a93aee7f0>
  File "/var/www/api.zettai.moe/htdocs/mypython/lib/python3.8/site-packages/starlette/middleware/errors.py", line 159, in __call__
    await self.app(scope, receive, _send)
          │    │   │      │        └ <function ServerErrorMiddleware.__call__.<locals>._send at 0x7f8a939aaa60>
          │    │   │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7f8a939...
          │    │   └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('xxx.xxx.xxx.xxx', 8080...
          │    └ <starlette.middleware.base.BaseHTTPMiddleware object at 0x7f8a939abb50>
          └ <starlette.middleware.errors.ServerErrorMiddleware object at 0x7f8a939abbb0>
  File "/var/www/api.zettai.moe/htdocs/mypython/lib/python3.8/site-packages/starlette/middleware/base.py", line 63, in __call__
    response = await self.dispatch_func(request, call_next)
                     │    │             │        └ <function BaseHTTPMiddleware.__call__.<locals>.call_next at 0x7f8a939c7ee0>
                     │    │             └ <starlette.requests.Request object at 0x7f8a939ab3d0>
                     │    └ <function uncaught_exception_handler at 0x7f8a939aaca0>
                     └ <starlette.middleware.base.BaseHTTPMiddleware object at 0x7f8a939abb50>
> File "/var/www/api.zettai.moe/htdocs/mypython/lib/python3.8/site-packages/hibiapi/app/middlewares.py", line 95, in uncaught_exception_handler
    response = await call_next(request)
                     │         └ <starlette.requests.Request object at 0x7f8a939ab3d0>
                     └ <function BaseHTTPMiddleware.__call__.<locals>.call_next at 0x7f8a939c7ee0>
  File "/var/www/api.zettai.moe/htdocs/mypython/lib/python3.8/site-packages/starlette/middleware/base.py", line 44, in call_next
    raise app_exc
          └ KeyError('auto_session_tracking')
  File "/var/www/api.zettai.moe/htdocs/mypython/lib/python3.8/site-packages/starlette/middleware/base.py", line 34, in coro
    await self.app(scope, request.receive, send_stream.send)
          │    │   │      │       │        │           └ <function MemoryObjectSendStream.send at 0x7f8a97d27430>
          │    │   │      │       │        └ MemoryObjectSendStream(_state=MemoryObjectStreamState(max_buffer_size=0, buffer=deque([]), open_send_channels=0, open_receive...
          │    │   │      │       └ <property object at 0x7f8a97c35270>
          │    │   │      └ <starlette.requests.Request object at 0x7f8a939ab3d0>
          │    │   └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('xxx.xxx.xxx.xxx', 8080...
          │    └ <starlette.middleware.base.BaseHTTPMiddleware object at 0x7f8a939abaf0>
          └ <starlette.middleware.base.BaseHTTPMiddleware object at 0x7f8a939abb50>
  File "/var/www/api.zettai.moe/htdocs/mypython/lib/python3.8/site-packages/starlette/middleware/base.py", line 63, in __call__
    response = await self.dispatch_func(request, call_next)
                     │    │             │        └ <function BaseHTTPMiddleware.__call__.<locals>.call_next at 0x7f8a919640d0>
                     │    │             └ <starlette.requests.Request object at 0x7f8a9195c370>
                     │    └ <function contextvar_setter at 0x7f8a939aac10>
                     └ <starlette.middleware.base.BaseHTTPMiddleware object at 0x7f8a939abaf0>
  File "/var/www/api.zettai.moe/htdocs/mypython/lib/python3.8/site-packages/hibiapi/app/middlewares.py", line 85, in contextvar_setter
    response = await call_next(request)
                     │         └ <starlette.requests.Request object at 0x7f8a9195c370>
                     └ <function BaseHTTPMiddleware.__call__.<locals>.call_next at 0x7f8a919640d0>
  File "/var/www/api.zettai.moe/htdocs/mypython/lib/python3.8/site-packages/starlette/middleware/base.py", line 44, in call_next
    raise app_exc
          └ KeyError('auto_session_tracking')
  File "/var/www/api.zettai.moe/htdocs/mypython/lib/python3.8/site-packages/starlette/middleware/base.py", line 34, in coro
    await self.app(scope, request.receive, send_stream.send)
          │    │   │      │       │        │           └ <function MemoryObjectSendStream.send at 0x7f8a97d27430>
          │    │   │      │       │        └ MemoryObjectSendStream(_state=MemoryObjectStreamState(max_buffer_size=0, buffer=deque([]), open_send_channels=0, open_receive...
          │    │   │      │       └ <property object at 0x7f8a97c35270>
          │    │   │      └ <starlette.requests.Request object at 0x7f8a9195c370>
          │    │   └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('xxx.xxx.xxx.xxx', 8080...
          │    └ <starlette.middleware.base.BaseHTTPMiddleware object at 0x7f8a939aba90>
          └ <starlette.middleware.base.BaseHTTPMiddleware object at 0x7f8a939abaf0>
  File "/var/www/api.zettai.moe/htdocs/mypython/lib/python3.8/site-packages/starlette/middleware/base.py", line 63, in __call__
    response = await self.dispatch_func(request, call_next)
                     │    │             │        └ <function BaseHTTPMiddleware.__call__.<locals>.call_next at 0x7f8a919883a0>
                     │    │             └ <starlette.requests.Request object at 0x7f8a919855b0>
                     │    └ <function request_logger at 0x7f8a939aab80>
                     └ <starlette.middleware.base.BaseHTTPMiddleware object at 0x7f8a939aba90>
  File "/var/www/api.zettai.moe/htdocs/mypython/lib/python3.8/site-packages/hibiapi/app/middlewares.py", line 54, in request_logger
    response = await call_next(request)
                     │         └ <starlette.requests.Request object at 0x7f8a919855b0>
                     └ <function BaseHTTPMiddleware.__call__.<locals>.call_next at 0x7f8a919883a0>
  File "/var/www/api.zettai.moe/htdocs/mypython/lib/python3.8/site-packages/starlette/middleware/base.py", line 44, in call_next
    raise app_exc
          └ KeyError('auto_session_tracking')
  File "/var/www/api.zettai.moe/htdocs/mypython/lib/python3.8/site-packages/starlette/middleware/base.py", line 34, in coro
    await self.app(scope, request.receive, send_stream.send)
          │    │   │      │       │        │           └ <function MemoryObjectSendStream.send at 0x7f8a97d27430>
          │    │   │      │       │        └ MemoryObjectSendStream(_state=MemoryObjectStreamState(max_buffer_size=0, buffer=deque([]), open_send_channels=0, open_receive...
          │    │   │      │       └ <property object at 0x7f8a97c35270>
          │    │   │      └ <starlette.requests.Request object at 0x7f8a919855b0>
          │    │   └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('xxx.xxx.xxx.xxx', 8080...
          │    └ <starlette.middleware.base.BaseHTTPMiddleware object at 0x7f8a939aba30>
          └ <starlette.middleware.base.BaseHTTPMiddleware object at 0x7f8a939aba90>
  File "/var/www/api.zettai.moe/htdocs/mypython/lib/python3.8/site-packages/starlette/middleware/base.py", line 63, in __call__
    response = await self.dispatch_func(request, call_next)
                     │    │             │        └ <function BaseHTTPMiddleware.__call__.<locals>.call_next at 0x7f8a919885e0>
                     │    │             └ <starlette.requests.Request object at 0x7f8a91985a60>
                     │    └ <function domain_limiter at 0x7f8a939aaaf0>
                     └ <starlette.middleware.base.BaseHTTPMiddleware object at 0x7f8a939aba30>
  File "/var/www/api.zettai.moe/htdocs/mypython/lib/python3.8/site-packages/hibiapi/app/middlewares.py", line 47, in domain_limiter
    return await call_next(request)
                 │         └ <starlette.requests.Request object at 0x7f8a91985a60>
                 └ <function BaseHTTPMiddleware.__call__.<locals>.call_next at 0x7f8a919885e0>
  File "/var/www/api.zettai.moe/htdocs/mypython/lib/python3.8/site-packages/starlette/middleware/base.py", line 44, in call_next
    raise app_exc
          └ KeyError('auto_session_tracking')
  File "/var/www/api.zettai.moe/htdocs/mypython/lib/python3.8/site-packages/starlette/middleware/base.py", line 34, in coro
    await self.app(scope, request.receive, send_stream.send)
          │    │   │      │       │        │           └ <function MemoryObjectSendStream.send at 0x7f8a97d27430>
          │    │   │      │       │        └ MemoryObjectSendStream(_state=MemoryObjectStreamState(max_buffer_size=0, buffer=deque([]), open_send_channels=0, open_receive...
          │    │   │      │       └ <property object at 0x7f8a97c35270>
          │    │   │      └ <starlette.requests.Request object at 0x7f8a91985a60>
          │    │   └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('xxx.xxx.xxx.xxx', 8080...
          │    └ <sentry_sdk.integrations.asgi.SentryAsgiMiddleware object at 0x7f8a939aba00>
          └ <starlette.middleware.base.BaseHTTPMiddleware object at 0x7f8a939aba30>
  File "/var/www/api.zettai.moe/htdocs/mypython/lib/python3.8/site-packages/sentry_sdk/integrations/asgi.py", line 107, in _run_asgi3
    return await self._run_app(scope, lambda: self.app(scope, receive, send))
                 │    │        │              │    │   │      │        └ <bound method MemoryObjectSendStream.send of MemoryObjectSendStream(_state=MemoryObjectStreamState(max_buffer_size=0, buffer=...
                 │    │        │              │    │   │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7f8a939...
                 │    │        │              │    │   └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('xxx.xxx.xxx.xxx', 8080...
                 │    │        │              │    └ <member 'app' of 'SentryAsgiMiddleware' objects>
                 │    │        │              └ <sentry_sdk.integrations.asgi.SentryAsgiMiddleware object at 0x7f8a939aba00>
                 │    │        └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('xxx.xxx.xxx.xxx', 8080...
                 │    └ <function SentryAsgiMiddleware._run_app at 0x7f8a939aa550>
                 └ <sentry_sdk.integrations.asgi.SentryAsgiMiddleware object at 0x7f8a939aba00>
  File "/var/www/api.zettai.moe/htdocs/mypython/lib/python3.8/site-packages/sentry_sdk/integrations/asgi.py", line 123, in _run_app
    with auto_session_tracking(hub, session_mode="request"):
         │                     └ <sentry_sdk.hub.Hub object at 0x7f8a91985e80>
         └ <function auto_session_tracking at 0x7f8a9d19eaf0>
  File "/usr/lib/python3.8/contextlib.py", line 113, in __enter__
    return next(self.gen)
                │    └ <generator object auto_session_tracking at 0x7f8a939cde40>
                └ <contextlib._GeneratorContextManager object at 0x7f8a91985ee0>
  File "/var/www/api.zettai.moe/htdocs/mypython/lib/python3.8/site-packages/sentry_sdk/sessions.py", line 39, in auto_session_tracking
    should_track = is_auto_session_tracking_enabled(hub)
                   │                                └ <sentry_sdk.hub.Hub object at 0x7f8a91985e80>
                   └ <function is_auto_session_tracking_enabled at 0x7f8a9d19e9d0>
  File "/var/www/api.zettai.moe/htdocs/mypython/lib/python3.8/site-packages/sentry_sdk/sessions.py", line 29, in is_auto_session_tracking_enabled
    should_track = client_options["auto_session_tracking"]
                   └ {}

KeyError: 'auto_session_tracking'
2022-02-14 11:16:54.176 | ERROR    | hibiapi.app.handlers:exception_handler:21 - Uncaught exception raised exc.data=ExceptionReturn(url=None, time=datetime.datetime(2022, 2, 14, 11, 16, 54, 175408), code=500, detail='KeyError', trace='8A3A82928E6C6786', headers={}):
Traceback (most recent call last):

  File "/var/www/api.zettai.moe/htdocs/mypython/lib/python3.8/site-packages/anyio/streams/memory.py", line 81, in receive
    return self.receive_nowait()
           │    └ <function MemoryObjectReceiveStream.receive_nowait at 0x7f8a97d1fca0>
           └ MemoryObjectReceiveStream(_state=MemoryObjectStreamState(max_buffer_size=0, buffer=deque([]), open_send_channels=0, open_rece...
  File "/var/www/api.zettai.moe/htdocs/mypython/lib/python3.8/site-packages/anyio/streams/memory.py", line 76, in receive_nowait
    raise WouldBlock
          └ <class 'anyio.WouldBlock'>

anyio.WouldBlock


During handling of the above exception, another exception occurred:


Traceback (most recent call last):

  File "/var/www/api.zettai.moe/htdocs/mypython/lib/python3.8/site-packages/starlette/middleware/base.py", line 41, in call_next
    message = await recv_stream.receive()
                    │           └ <function MemoryObjectReceiveStream.receive at 0x7f8a97d1fd30>
                    └ MemoryObjectReceiveStream(_state=MemoryObjectStreamState(max_buffer_size=0, buffer=deque([]), open_send_channels=0, open_rece...
  File "/var/www/api.zettai.moe/htdocs/mypython/lib/python3.8/site-packages/anyio/streams/memory.py", line 101, in receive
    raise EndOfStream
          └ <class 'anyio.EndOfStream'>

anyio.EndOfStream


During handling of the above exception, another exception occurred:


Traceback (most recent call last):

  File "/var/www/api.zettai.moe/htdocs/mypython/bin/hibiapi", line 8, in <module>
    sys.exit(main())
    │   │    └ <Command HibiAPI>
    │   └ <built-in function exit>
    └ <module 'sys' (built-in)>
  File "/var/www/api.zettai.moe/htdocs/mypython/lib/python3.8/site-packages/click/core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
           │    │     │       └ {}
           │    │     └ ()
           │    └ <function BaseCommand.main at 0x7f8a9e73c280>
           └ <Command HibiAPI>
  File "/var/www/api.zettai.moe/htdocs/mypython/lib/python3.8/site-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
         │    │      └ <click.core.Context object at 0x7f8a9e981fd0>
         │    └ <function Command.invoke at 0x7f8a9e5cff70>
         └ <Command HibiAPI>
  File "/var/www/api.zettai.moe/htdocs/mypython/lib/python3.8/site-packages/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           │   │      │    │           │   └ {'host': 'xxx.xxx.xxx.xxx', 'port': 8080, 'workers': 1, 'reload': False}
           │   │      │    │           └ <click.core.Context object at 0x7f8a9e981fd0>
           │   │      │    └ <function main at 0x7f8a9d1344c0>
           │   │      └ <Command HibiAPI>
           │   └ <function Context.invoke at 0x7f8a9e73ca60>
           └ <click.core.Context object at 0x7f8a9e981fd0>
  File "/var/www/api.zettai.moe/htdocs/mypython/lib/python3.8/site-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
                       │       └ {'host': 'xxx.xxx.xxx.xxx', 'port': 8080, 'workers': 1, 'reload': False}
                       └ ()
  File "/var/www/api.zettai.moe/htdocs/mypython/lib/python3.8/site-packages/hibiapi/__main__.py", line 87, in main
    uvicorn.run(
    │       └ <function run at 0x7f8a9dc178b0>
    └ <module 'uvicorn' from '/var/www/api.zettai.moe/htdocs/mypython/lib/python3.8/site-packages/uvicorn/__init__.py'>
  File "/var/www/api.zettai.moe/htdocs/mypython/lib/python3.8/site-packages/uvicorn/main.py", line 461, in run
    server.run()
    │      └ <function Server.run at 0x7f8a9dc173a0>
    └ <uvicorn.server.Server object at 0x7f8a9d127790>
  File "/var/www/api.zettai.moe/htdocs/mypython/lib/python3.8/site-packages/uvicorn/server.py", line 60, in run
    return asyncio.run(self.serve(sockets=sockets))
           │       │   │    │             └ None
           │       │   │    └ <function Server.serve at 0x7f8a9dc17430>
           │       │   └ <uvicorn.server.Server object at 0x7f8a9d127790>
           │       └ <function run at 0x7f8a9e5ec820>
           └ <module 'asyncio' from '/usr/lib/python3.8/asyncio/__init__.py'>
  File "/usr/lib/python3.8/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
           │    │                  └ <coroutine object Server.serve at 0x7f8a9d126ac0>
           │    └ <method 'run_until_complete' of 'uvloop.loop.Loop' objects>
           └ <uvloop.Loop running=True closed=False debug=False>
  File "/var/www/api.zettai.moe/htdocs/mypython/lib/python3.8/site-packages/uvicorn/protocols/http/httptools_impl.py", line 367, in run_asgi
    result = await app(self.scope, self.receive, self.send)
                   │   │    │      │    │        │    └ <function RequestResponseCycle.send at 0x7f8a9c4f7040>
                   │   │    │      │    │        └ <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7f8a919857c0>
                   │   │    │      │    └ <function RequestResponseCycle.receive at 0x7f8a9c4f70d0>
                   │   │    │      └ <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7f8a919857c0>
                   │   │    └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('xxx.xxx.xxx.xxx', 8080...
                   │   └ <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7f8a919857c0>
                   └ <uvicorn.middleware.proxy_headers.ProxyHeadersMiddleware object at 0x7f8a9d135f70>
  File "/var/www/api.zettai.moe/htdocs/mypython/lib/python3.8/site-packages/uvicorn/middleware/proxy_headers.py", line 75, in __call__
    return await self.app(scope, receive, send)
                 │    │   │      │        └ <bound method RequestResponseCycle.send of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7f8a919857...
                 │    │   │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7f8a919...
                 │    │   └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('xxx.xxx.xxx.xxx', 8080...
                 │    └ <fastapi.applications.FastAPI object at 0x7f8a93aee7f0>
                 └ <uvicorn.middleware.proxy_headers.ProxyHeadersMiddleware object at 0x7f8a9d135f70>
  File "/var/www/api.zettai.moe/htdocs/mypython/lib/python3.8/site-packages/fastapi/applications.py", line 208, in __call__
    await super().__call__(scope, receive, send)
                           │      │        └ <bound method RequestResponseCycle.send of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7f8a919857...
                           │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7f8a919...
                           └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('xxx.xxx.xxx.xxx', 8080...
  File "/var/www/api.zettai.moe/htdocs/mypython/lib/python3.8/site-packages/starlette/applications.py", line 112, in __call__
    await self.middleware_stack(scope, receive, send)
          │    │                │      │        └ <bound method RequestResponseCycle.send of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7f8a919857...
          │    │                │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7f8a919...
          │    │                └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('xxx.xxx.xxx.xxx', 8080...
          │    └ <starlette.middleware.errors.ServerErrorMiddleware object at 0x7f8a939abbb0>
          └ <fastapi.applications.FastAPI object at 0x7f8a93aee7f0>
  File "/var/www/api.zettai.moe/htdocs/mypython/lib/python3.8/site-packages/starlette/middleware/errors.py", line 159, in __call__
    await self.app(scope, receive, _send)
          │    │   │      │        └ <function ServerErrorMiddleware.__call__.<locals>._send at 0x7f8a939aaa60>
          │    │   │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7f8a919...
          │    │   └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('xxx.xxx.xxx.xxx', 8080...
          │    └ <starlette.middleware.base.BaseHTTPMiddleware object at 0x7f8a939abb50>
          └ <starlette.middleware.errors.ServerErrorMiddleware object at 0x7f8a939abbb0>
  File "/var/www/api.zettai.moe/htdocs/mypython/lib/python3.8/site-packages/starlette/middleware/base.py", line 63, in __call__
    response = await self.dispatch_func(request, call_next)
                     │    │             │        └ <function BaseHTTPMiddleware.__call__.<locals>.call_next at 0x7f8a939aad30>
                     │    │             └ <starlette.requests.Request object at 0x7f8a9185c250>
                     │    └ <function uncaught_exception_handler at 0x7f8a939aaca0>
                     └ <starlette.middleware.base.BaseHTTPMiddleware object at 0x7f8a939abb50>
> File "/var/www/api.zettai.moe/htdocs/mypython/lib/python3.8/site-packages/hibiapi/app/middlewares.py", line 95, in uncaught_exception_handler
    response = await call_next(request)
                     │         └ <starlette.requests.Request object at 0x7f8a9185c250>
                     └ <function BaseHTTPMiddleware.__call__.<locals>.call_next at 0x7f8a939aad30>
  File "/var/www/api.zettai.moe/htdocs/mypython/lib/python3.8/site-packages/starlette/middleware/base.py", line 44, in call_next
    raise app_exc
          └ KeyError('auto_session_tracking')
  File "/var/www/api.zettai.moe/htdocs/mypython/lib/python3.8/site-packages/starlette/middleware/base.py", line 34, in coro
    await self.app(scope, request.receive, send_stream.send)
          │    │   │      │       │        │           └ <function MemoryObjectSendStream.send at 0x7f8a97d27430>
          │    │   │      │       │        └ MemoryObjectSendStream(_state=MemoryObjectStreamState(max_buffer_size=0, buffer=deque([]), open_send_channels=0, open_receive...
          │    │   │      │       └ <property object at 0x7f8a97c35270>
          │    │   │      └ <starlette.requests.Request object at 0x7f8a9185c250>
          │    │   └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('xxx.xxx.xxx.xxx', 8080...
          │    └ <starlette.middleware.base.BaseHTTPMiddleware object at 0x7f8a939abaf0>
          └ <starlette.middleware.base.BaseHTTPMiddleware object at 0x7f8a939abb50>
  File "/var/www/api.zettai.moe/htdocs/mypython/lib/python3.8/site-packages/starlette/middleware/base.py", line 63, in __call__
    response = await self.dispatch_func(request, call_next)
                     │    │             │        └ <function BaseHTTPMiddleware.__call__.<locals>.call_next at 0x7f8a918c9b80>
                     │    │             └ <starlette.requests.Request object at 0x7f8a9185c5e0>
                     │    └ <function contextvar_setter at 0x7f8a939aac10>
                     └ <starlette.middleware.base.BaseHTTPMiddleware object at 0x7f8a939abaf0>
  File "/var/www/api.zettai.moe/htdocs/mypython/lib/python3.8/site-packages/hibiapi/app/middlewares.py", line 85, in contextvar_setter
    response = await call_next(request)
                     │         └ <starlette.requests.Request object at 0x7f8a9185c5e0>
                     └ <function BaseHTTPMiddleware.__call__.<locals>.call_next at 0x7f8a918c9b80>
  File "/var/www/api.zettai.moe/htdocs/mypython/lib/python3.8/site-packages/starlette/middleware/base.py", line 44, in call_next
    raise app_exc
          └ KeyError('auto_session_tracking')
  File "/var/www/api.zettai.moe/htdocs/mypython/lib/python3.8/site-packages/starlette/middleware/base.py", line 34, in coro
    await self.app(scope, request.receive, send_stream.send)
          │    │   │      │       │        │           └ <function MemoryObjectSendStream.send at 0x7f8a97d27430>
          │    │   │      │       │        └ MemoryObjectSendStream(_state=MemoryObjectStreamState(max_buffer_size=0, buffer=deque([]), open_send_channels=0, open_receive...
          │    │   │      │       └ <property object at 0x7f8a97c35270>
          │    │   │      └ <starlette.requests.Request object at 0x7f8a9185c5e0>
          │    │   └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('xxx.xxx.xxx.xxx', 8080...
          │    └ <starlette.middleware.base.BaseHTTPMiddleware object at 0x7f8a939aba90>
          └ <starlette.middleware.base.BaseHTTPMiddleware object at 0x7f8a939abaf0>
  File "/var/www/api.zettai.moe/htdocs/mypython/lib/python3.8/site-packages/starlette/middleware/base.py", line 63, in __call__
    response = await self.dispatch_func(request, call_next)
                     │    │             │        └ <function BaseHTTPMiddleware.__call__.<locals>.call_next at 0x7f8a918c9d30>
                     │    │             └ <starlette.requests.Request object at 0x7f8a9185caf0>
                     │    └ <function request_logger at 0x7f8a939aab80>
                     └ <starlette.middleware.base.BaseHTTPMiddleware object at 0x7f8a939aba90>
  File "/var/www/api.zettai.moe/htdocs/mypython/lib/python3.8/site-packages/hibiapi/app/middlewares.py", line 54, in request_logger
    response = await call_next(request)
                     │         └ <starlette.requests.Request object at 0x7f8a9185caf0>
                     └ <function BaseHTTPMiddleware.__call__.<locals>.call_next at 0x7f8a918c9d30>
  File "/var/www/api.zettai.moe/htdocs/mypython/lib/python3.8/site-packages/starlette/middleware/base.py", line 44, in call_next
    raise app_exc
          └ KeyError('auto_session_tracking')
  File "/var/www/api.zettai.moe/htdocs/mypython/lib/python3.8/site-packages/starlette/middleware/base.py", line 34, in coro
    await self.app(scope, request.receive, send_stream.send)
          │    │   │      │       │        │           └ <function MemoryObjectSendStream.send at 0x7f8a97d27430>
          │    │   │      │       │        └ MemoryObjectSendStream(_state=MemoryObjectStreamState(max_buffer_size=0, buffer=deque([]), open_send_channels=0, open_receive...
          │    │   │      │       └ <property object at 0x7f8a97c35270>
          │    │   │      └ <starlette.requests.Request object at 0x7f8a9185caf0>
          │    │   └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('xxx.xxx.xxx.xxx', 8080...
          │    └ <starlette.middleware.base.BaseHTTPMiddleware object at 0x7f8a939aba30>
          └ <starlette.middleware.base.BaseHTTPMiddleware object at 0x7f8a939aba90>
  File "/var/www/api.zettai.moe/htdocs/mypython/lib/python3.8/site-packages/starlette/middleware/base.py", line 63, in __call__
    response = await self.dispatch_func(request, call_next)
                     │    │             │        └ <function BaseHTTPMiddleware.__call__.<locals>.call_next at 0x7f8a918c9f70>
                     │    │             └ <starlette.requests.Request object at 0x7f8a9185cf70>
                     │    └ <function domain_limiter at 0x7f8a939aaaf0>
                     └ <starlette.middleware.base.BaseHTTPMiddleware object at 0x7f8a939aba30>
  File "/var/www/api.zettai.moe/htdocs/mypython/lib/python3.8/site-packages/hibiapi/app/middlewares.py", line 47, in domain_limiter
    return await call_next(request)
                 │         └ <starlette.requests.Request object at 0x7f8a9185cf70>
                 └ <function BaseHTTPMiddleware.__call__.<locals>.call_next at 0x7f8a918c9f70>
  File "/var/www/api.zettai.moe/htdocs/mypython/lib/python3.8/site-packages/starlette/middleware/base.py", line 44, in call_next
    raise app_exc
          └ KeyError('auto_session_tracking')
  File "/var/www/api.zettai.moe/htdocs/mypython/lib/python3.8/site-packages/starlette/middleware/base.py", line 34, in coro
    await self.app(scope, request.receive, send_stream.send)
          │    │   │      │       │        │           └ <function MemoryObjectSendStream.send at 0x7f8a97d27430>
          │    │   │      │       │        └ MemoryObjectSendStream(_state=MemoryObjectStreamState(max_buffer_size=0, buffer=deque([]), open_send_channels=0, open_receive...
          │    │   │      │       └ <property object at 0x7f8a97c35270>
          │    │   │      └ <starlette.requests.Request object at 0x7f8a9185cf70>
          │    │   └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('xxx.xxx.xxx.xxx', 8080...
          │    └ <sentry_sdk.integrations.asgi.SentryAsgiMiddleware object at 0x7f8a939aba00>
          └ <starlette.middleware.base.BaseHTTPMiddleware object at 0x7f8a939aba30>
  File "/var/www/api.zettai.moe/htdocs/mypython/lib/python3.8/site-packages/sentry_sdk/integrations/asgi.py", line 107, in _run_asgi3
    return await self._run_app(scope, lambda: self.app(scope, receive, send))
                 │    │        │              │    │   │      │        └ <bound method MemoryObjectSendStream.send of MemoryObjectSendStream(_state=MemoryObjectStreamState(max_buffer_size=0, buffer=...
                 │    │        │              │    │   │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7f8a919...
                 │    │        │              │    │   └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('xxx.xxx.xxx.xxx', 8080...
                 │    │        │              │    └ <member 'app' of 'SentryAsgiMiddleware' objects>
                 │    │        │              └ <sentry_sdk.integrations.asgi.SentryAsgiMiddleware object at 0x7f8a939aba00>
                 │    │        └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('xxx.xxx.xxx.xxx', 8080...
                 │    └ <function SentryAsgiMiddleware._run_app at 0x7f8a939aa550>
                 └ <sentry_sdk.integrations.asgi.SentryAsgiMiddleware object at 0x7f8a939aba00>
  File "/var/www/api.zettai.moe/htdocs/mypython/lib/python3.8/site-packages/sentry_sdk/integrations/asgi.py", line 123, in _run_app
    with auto_session_tracking(hub, session_mode="request"):
         │                     └ <sentry_sdk.hub.Hub object at 0x7f8a918693a0>
         └ <function auto_session_tracking at 0x7f8a9d19eaf0>
  File "/usr/lib/python3.8/contextlib.py", line 113, in __enter__
    return next(self.gen)
                │    └ <generator object auto_session_tracking at 0x7f8a91853900>
                └ <contextlib._GeneratorContextManager object at 0x7f8a91869400>
  File "/var/www/api.zettai.moe/htdocs/mypython/lib/python3.8/site-packages/sentry_sdk/sessions.py", line 39, in auto_session_tracking
    should_track = is_auto_session_tracking_enabled(hub)
                   │                                └ <sentry_sdk.hub.Hub object at 0x7f8a918693a0>
                   └ <function is_auto_session_tracking_enabled at 0x7f8a9d19e9d0>
  File "/var/www/api.zettai.moe/htdocs/mypython/lib/python3.8/site-packages/sentry_sdk/sessions.py", line 29, in is_auto_session_tracking_enabled
    should_track = client_options["auto_session_tracking"]
                   └ {}

KeyError: 'auto_session_tracking'
2022-02-14 11:17:07.275 | INFO     | uvicorn.server:shutdown:252 - Shutting down
2022-02-14 11:17:07.377 | INFO     | uvicorn.server:serve:85 - Finished server process [2035]

@mnixry mnixry closed this as completed in 2c5407f Feb 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants