In some situations, when doing a search for dashboards is resulting in an AttributeError exception on obj.user.to_dict(). I have been unable to yet pinpoint any direct cause, only the process that leads up to the issue. In addition, the issue only manifests when searching, and only with some characters, not all. Primarily if there is a large number of results. If I just navigate through the pages on the Dashboards list, there is no issues experienced.
The order that I have been able to trace through the code, which leads to this problem is this:
- User types in search in the Dashboards page of Re:Dash
DashboardListResourceis called to search DB for dashboards the meets the query using
DashboardListResourceorders the results of that query - Successful
serialize_dashboardas part of the pagination process for the the results of the order_results - Successful
handlers.base.paginatepaginates the results and passes it over to
serialize_dashboardexecutes to serialize the paginated results to return - Fails (
items = [serializer(result) for result in results.items]fails with the exception
AttributeError: 'NoneType' object has no attribute 'to_dict')
This issue appears to have started after we upgraded from Re:Dash 6.0.0 to 8.0.0. We used the normal DB upgrade scripts as part of the upgrade process.
This is the traceback being experienced:
[2020-04-14 12:10:05,461] ERROR in app: Exception on /api/dashboards [GET] Traceback (most recent call last): File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1612, in full_dispatch_request rv = self.dispatch_request() File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1598, in dispatch_request return self.view_functions[rule.endpoint](**req.view_args) File "/usr/local/lib/python2.7/site-packages/flask_restful/__init__.py", line 477, in wrapper resp = resource(*args, **kwargs) File "/usr/local/lib/python2.7/site-packages/flask_login/utils.py", line 228, in decorated_view return func(*args, **kwargs) File "/usr/local/lib/python2.7/site-packages/flask/views.py", line 84, in view return self.dispatch_request(*args, **kwargs) File "/app/redash/handlers/base.py", line 31, in dispatch_request return super(BaseResource, self).dispatch_request(*args, **kwargs) File "/usr/local/lib/python2.7/site-packages/flask_restful/__init__.py\", line 587, in dispatch_request resp = meth(*args, **kwargs) File "/app/redash/permissions.py", line 67, in decorated return fn(*args, **kwargs) File "/app/redash/handlers/dashboards.py", line 76, in get serializer=serialize_dashboard, File "/app/redash/handlers/base.py", line 108, in paginate items = [serializer(result) for result in results.items] File "/app/redash/serializers/__init__.py", line 214, in serialize_dashboard 'user': obj.user.to_dict(), AttributeError: 'NoneType' object has no attribute 'to_dict'
Any assistance in identifying this issue would be greatly appreciated as this is greatly degrading the user’s ability to interact with Re:Dash.
- Redash Version: 8.0.0+b32245
- Browser/OS: Chrome (Running on Linux, impacts all users, regardless of OS)
- How did you install Redash: Docker