OpenAdapt icon indicating copy to clipboard operation
OpenAdapt copied to clipboard

[Bug]: Dashboard fails silently

Open abrichr opened this issue 9 months ago • 0 comments

Describe the bug

The dashboard should display an error message to the user when an exception occurs:

[1]   File "/Users/abrichr/Library/Caches/pypoetry/virtualenvs/openadapt-VBXg4jpm-py3.10/lib/python3.10/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app                     16:45:54 [219/3601]
[1]     raise exc                                                                                                                                                                                                      
[1]   File "/Users/abrichr/Library/Caches/pypoetry/virtualenvs/openadapt-VBXg4jpm-py3.10/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app                                        
[1]     await app(scope, receive, sender)                                                                                                                                                                              
[1]   File "/Users/abrichr/Library/Caches/pypoetry/virtualenvs/openadapt-VBXg4jpm-py3.10/lib/python3.10/site-packages/starlette/routing.py", line 756, in __call__                                                     
[1]     await self.middleware_stack(scope, receive, send)                                                                                                                                                              
[1]   File "/Users/abrichr/Library/Caches/pypoetry/virtualenvs/openadapt-VBXg4jpm-py3.10/lib/python3.10/site-packages/starlette/routing.py", line 776, in app                                                          
[1]     await route.handle(scope, receive, send)                                                                                                                                                                       
[1]   File "/Users/abrichr/Library/Caches/pypoetry/virtualenvs/openadapt-VBXg4jpm-py3.10/lib/python3.10/site-packages/starlette/routing.py", line 373, in handle                                                       
[1]     await self.app(scope, receive, send)                                                                                                                                                                           
[1]   File "/Users/abrichr/Library/Caches/pypoetry/virtualenvs/openadapt-VBXg4jpm-py3.10/lib/python3.10/site-packages/starlette/routing.py", line 96, in app                                                           
[1]     await wrap_app_handling_exceptions(app, session)(scope, receive, send)                                                                                                             
[1]   File "/Users/abrichr/Library/Caches/pypoetry/virtualenvs/openadapt-VBXg4jpm-py3.10/lib/python3.10/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app             
[1]     raise exc                                                                                                                                                                           
[1]   File "/Users/abrichr/Library/Caches/pypoetry/virtualenvs/openadapt-VBXg4jpm-py3.10/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app             
[1]     await app(scope, receive, sender)                                                                                                                                                   
[1]   File "/Users/abrichr/Library/Caches/pypoetry/virtualenvs/openadapt-VBXg4jpm-py3.10/lib/python3.10/site-packages/starlette/routing.py", line 94, in app                                
[1]     await func(session)                                                                                                                                                                 
[1]   File "/Users/abrichr/Library/Caches/pypoetry/virtualenvs/openadapt-VBXg4jpm-py3.10/lib/python3.10/site-packages/fastapi/routing.py", line 348, in app                                 
[1]     await dependant.call(**values)                                                                                                                                                      
[1]   File "/Users/abrichr/oa/OpenAdapt/openadapt/app/dashboard/api/recordings.py", line 69, in get_recording_detail                                                                        
[1]     action_events = get_events(recording, session=session)                                                                                                                              
[1]   File "/Users/abrichr/oa/OpenAdapt/openadapt/events.py", line 71, in get_events                                                                                                        
[1]     models.update_related_objects(                                                                                                                                                      
[1]   File "/Users/abrichr/oa/OpenAdapt/openadapt/models.py", line 563, in update_related_objects                                                                                           
[1]     new_related_object = old_to_new_mapping[related_object]                                                                                                                             
[1] KeyError: ActionEvent(id=6755, name='press', timestamp=1715287494.5631533, recording_timestamp=1715287490.299658, screenshot_timestamp=1715287494.5254707, window_event_timestamp=1715287490.4215562, key_name='ctr
l', canonical_key_name='ctrl', key=<Key.ctrl: <59>>, text='<ctrl>', canonical_key=<Key.ctrl: <59>>, canonical_text='<ctrl>')                                                                
[1] ERROR:    closing handshake failed               
[1] Traceback (most recent call last):               
[1]   File "/Users/abrichr/Library/Caches/pypoetry/virtualenvs/openadapt-VBXg4jpm-py3.10/lib/python3.10/site-packages/websockets/legacy/server.py", line 248, in handler                                               
[1]     await self.close()                           
[1]   File "/Users/abrichr/Library/Caches/pypoetry/virtualenvs/openadapt-VBXg4jpm-py3.10/lib/python3.10/site-packages/websockets/legacy/protocol.py", line 766, in close                                               
[1]     await self.write_close_frame(Close(code, reason))                                                  
[1]   File "/Users/abrichr/Library/Caches/pypoetry/virtualenvs/openadapt-VBXg4jpm-py3.10/lib/python3.10/site-packages/websockets/legacy/protocol.py", line 1232, in write_close_frame                                  
[1]     await self.write_frame(True, OP_CLOSE, data, _state=State.CLOSING)                                 
[1]   File "/Users/abrichr/Library/Caches/pypoetry/virtualenvs/openadapt-VBXg4jpm-py3.10/lib/python3.10/site-packages/websockets/legacy/protocol.py", line 1205, in write_frame                                        
[1]     await self.drain()                           
[1]   File "/Users/abrichr/Library/Caches/pypoetry/virtualenvs/openadapt-VBXg4jpm-py3.10/lib/python3.10/site-packages/websockets/legacy/protocol.py", line 1194, in drain                                              
[1]     await self.ensure_open()                     
[1]   File "/Users/abrichr/Library/Caches/pypoetry/virtualenvs/openadapt-VBXg4jpm-py3.10/lib/python3.10/site-packages/websockets/legacy/protocol.py", line 935, in ensure_open                                         
[1]     raise self.connection_closed_exc()           
[1] websockets.exceptions.ConnectionClosedError: sent 1000 (OK); no close frame received                   
[1] INFO:     connection closed  

To Reproduce

I just created a simple recording and tried to run the dashboard with python -m openadapt.app.dashboard.run. There appears to be a bug elsewhere that caused this particular exception. For development purposes we can just manually raise an exception in get_events.

abrichr avatar May 09 '24 20:05 abrichr