Kemono2 icon indicating copy to clipboard operation
Kemono2 copied to clipboard

Broken session cookie can error out the backend

Open C0rn3j opened this issue 2 years ago • 0 comments

kemono.log from the prod container image kemono-2_kemono-app

Ran into this when switching from the dev docker setup to prod without clearing the session cookie.

ERROR:server:Exception on / [GET]                                                                                                                                                                                                                                                                                           
Traceback (most recent call last):                                                                                                                                                                                                                                                                                          
  File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 2070, in wsgi_app                                                                                                                                                                                                                                        
    response = self.full_dispatch_request()                                                                                                                                                                                                                                                                                 
  File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1515, in full_dispatch_request                                                                                                                                                                                                                           
    rv = self.handle_user_exception(e)                                                                                                                                                                                                                                                                                      
  File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1511, in full_dispatch_request                                                                                                                                                                                                                           
    rv = self.preprocess_request()                                                                                                                                                                                                                                                                                          
  File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1857, in preprocess_request                                                                                                                                                                                                                              
    rv = self.ensure_sync(func)()                                                                                                                                                                                                                                                                                           
  File "/app/./server.py", line 100, in do_init_stuff                                                                                                                                                                                                                                                                       
    account = load_account()                                                                                                                                                                                                                                                                                                
  File "/app/./src/lib/account.py", line 29, in load_account                                                                                                                                                                                                                                                                
    return load_account(session['account_id'], reload)                                                                                                                                                                                                                                                                      
  File "/app/./src/lib/account.py", line 45, in load_account                                                                                                                                                                                                                                                                
    redis.set(key, serialize_account(account))                                                                                                                                                                                                                                                                              
  File "/app/./src/lib/account.py", line 228, in serialize_account                                                                                                                                                                                                                                                          
    return ujson.dumps(prepare_account_fields(account))                                                                                                                                                                                                                                                                     
  File "/app/./src/lib/account.py", line 237, in prepare_account_fields                                                                                                                                                                                                                                                     
    account['created_at'] = account['created_at'].isoformat()                                                                                                                                                                                                                                                               
TypeError: 'NoneType' object is not subscriptable
DEBUG:server:[2022-03-23 08:28:53] Completed GET request to http://kemono/ in 2.859ms with ab test variants: {}

image

C0rn3j avatar Mar 23 '22 08:03 C0rn3j