ail-framework icon indicating copy to clipboard operation
ail-framework copied to clipboard

Unable to create a new user / Internal Server Error

Open ITSEC-DACHSER opened this issue 2 years ago • 2 comments

Hi!

I´m running a new installed Version of AIL 4.2 under Debian 11. It´s not possible to create a new user because of an Internal Server Error.

Here are two screenshots: AIL_Create-User

By click on submit: AIL_Create-User_Error

Is there any log i can provide for a debug ? Thank you!

ITSEC-DACHSER avatar Aug 09 '22 12:08 ITSEC-DACHSER

Hey @ITSEC-DACHSER !

Can check the output of the Flask server ? screen -r Flask_AIL

Terrtia avatar Aug 09 '22 12:08 Terrtia

Thanks for your hint.

Here is the output:


[2022-08-18 10:56:55,758] ERROR in app: Exception on /settings/create_user_post [POST]
Traceback (most recent call last):
  File "/home/itsec/ail-framework/AILENV/lib/python3.9/site-packages/flask/app.py", line 2073, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/itsec/ail-framework/AILENV/lib/python3.9/site-packages/flask/app.py", line 1518, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/itsec/ail-framework/AILENV/lib/python3.9/site-packages/flask/app.py", line 1516, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/itsec/ail-framework/AILENV/lib/python3.9/site-packages/flask/app.py", line 1502, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
  File "/home/itsec/ail-framework/AILENV/lib/python3.9/site-packages/flask_login/utils.py", line 272, in decorated_view
    return func(*args, **kwargs)
  File "./modules/Role_Manager.py", line 58, in decorated_view
    return func(*args, **kwargs)
  File "/home/itsec/ail-framework/var/www/modules/settings/Flask_settings.py", line 196, in create_user_post
    create_user_db(email, password, default=True, role=role)
  File "./modules/Role_Manager.py", line 136, in create_user_db
    generate_new_token(username_id)
  File "./modules/Role_Manager.py", line 120, in generate_new_token
    r_serv_db.hdel('user:tokens', current_token)
  File "/home/itsec/ail-framework/AILENV/lib/python3.9/site-packages/redis/commands/core.py", line 3685, in hdel
    return self.execute_command("HDEL", name, *keys)
  File "/home/itsec/ail-framework/AILENV/lib/python3.9/site-packages/redis/client.py", line 1176, in execute_command
    return conn.retry.call_with_retry(
  File "/home/itsec/ail-framework/AILENV/lib/python3.9/site-packages/redis/retry.py", line 45, in call_with_retry
    return do()
  File "/home/itsec/ail-framework/AILENV/lib/python3.9/site-packages/redis/client.py", line 1177, in <lambda>
    lambda: self._send_command_parse_response(
  File "/home/itsec/ail-framework/AILENV/lib/python3.9/site-packages/redis/client.py", line 1152, in _send_command_parse_response
    conn.send_command(*args)
  File "/home/itsec/ail-framework/AILENV/lib/python3.9/site-packages/redis/connection.py", line 796, in send_command
    self.pack_command(*args), check_health=kwargs.get("check_health", True)
  File "/home/itsec/ail-framework/AILENV/lib/python3.9/site-packages/redis/connection.py", line 848, in pack_command
    for arg in map(self.encoder.encode, args):
  File "/home/itsec/ail-framework/AILENV/lib/python3.9/site-packages/redis/connection.py", line 110, in encode
    raise DataError(
redis.exceptions.DataError: Invalid input of type: 'NoneType'. Convert to a bytes, string, int or float first.
x.x.x.x - - [18/Aug/2022 10:56:55] "POST /settings/create_user_post HTTP/1.1" 500 -
x.x.x.x - - [18/Aug/2022 10:56:56] "GET /favicon.ico HTTP/1.1" 404 -

If more info is needed please let me know. Thank you.

ITSEC-DACHSER avatar Aug 18 '22 09:08 ITSEC-DACHSER

I have the same issue. May the problem resides in the "current_token = r_serv_db.hget('user_metadata:{}'.format(user_id), 'token')" that doesn't return anything for new users.

Yosirion avatar Oct 05 '22 09:10 Yosirion

Fixed in AIL v5.0

Terrtia avatar Jun 06 '23 14:06 Terrtia