Issue Summary

redash_server_1 log

[2018-10-10 12:48:45,419][PID:14][ERROR][redash] Exception on /api/queries [GET]
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1639, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1625, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/usr/local/lib/python2.7/dist-packages/flask_restful/__init__.py", line 477, in wrapper
    resp = resource(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/flask_login/utils.py", line 228, in decorated_view
    return func(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-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/dist-packages/flask_restful/__init__.py", line 587, in dispatch_request
    resp = meth(*args, **kwargs)
  File "/app/redash/permissions.py", line 48, in decorated
    return fn(*args, **kwargs)
  File "/app/redash/handlers/queries.py", line 197, in get
    with_last_modified_by=False
  File "/app/redash/handlers/base.py", line 106, in paginate
    items = serializer(results.items, **kwargs).serialize()
  File "/app/redash/serializers.py", line 75, in serialize
    result = [serialize_query(query, **self.options) for query in self.object_or_list]
  File "/app/redash/serializers.py", line 105, in serialize_query
    d['user'] = query.user.to_dict()
AttributeError: 'NoneType' object has no attribute 'to_dict'

even I upgrade the redash version.
the problem was not fixed.

Technical details:

  • Redash Version: 5.0.0-beta.b4476 & latest & 5.0.1+b4850
  • Browser/OS: Chrome 69.0.3497.100(Official Build) 64bit
  • How did you install Redash: docker

Did you delete one of the users in the system?

1 Like

yes I did.
because I created 2 users same email address and same same mistakenly.

once I created, he cannot login redash.

May I ask how can I fix it??

I fixed the issue!
Thank you @arikfr
I canged the data on postgress.


here are history

I created 2 users same email address and same name mistakenly.

using below command

docker exec -it redash_server_1 ./manage.py users create xxx@test.com xxx

the status was successful.
but new user cannot login to the redash. (encounterd Internal Error)

I remove the user

docker exec -it redash_server_1 ./manage.py users delete xxx@test.com 

the new user can login to the redash.
But I encounterd below error.

how to fix the issue

postgres=# select * from users order by org_id;
          updated_at           |          created_at           | id | org_id |        name        |                  email                  |                                                      password_hash                                                       |  groups   |                 api_key                  | profile_image_url |          disabled_at          
-------------------------------+-------------------------------+----+--------+--------------------+-----------------------------------------+--------------------------------------------------------------------------------------------------------------------------+-----------+------------------------------------------+-------------------+-------------------------------
(skip)
2018-08-30 06:48:30.812508+00 | 2018-08-30 06:40:15.029328+00 | 51 |      1 | ***     | gomes@sumito.jp               | ***  | {2,5}     | *** |                   | 
2018-10-09 08:18:34.331088+00 | 2018-10-09 08:17:20.97545+00  | 55 |      1 | taro   | taro@sumito.jp          | ***  | {2,5}     | *** |                   | 
2018-10-09 08:18:37.220691+00 | 2018-10-09 08:18:00.078037+00 | 56 |      1 | jiro     | jiro@sumito.jp            | *** | {2,5}     | *** |   
-----

id 52~54 was lack of the number.
due to I deleted some users.

I’ve changed id from 55,56 to 52,53 each.

update users set id = 52 where email = 'taro@sumito.jp';
update users set id = 53 where email = 'jiro@sumito.jp';

after that, I changed users_id_seq
SEQUENCE from 56 to 53

ALTER SEQUENCE users_id_seq RESTART  WITH 53;

Thats it.
Again, @arikfr thank you for giving me the clue.

But I wonder why I can create same user on redash…

I wrote detail of the issue.
But sorry, the infomation is writen in Japanese.

tsukada.sumito.jp/2018/10/11/redash_all-queries_loading/

Thank you for following up with the details of how you resolved this!

We should probably change the CLI to use the API, as the API is safer for this kind of things.

1 Like