Cannot save ldap resolver - 500 Error

image
Logs
[2023-07-18 14:25:39,286][10598][140378614986496][WARNING][privacyidea.lib.resolvers.LDAPIdResolver:1083] Error during fetching LDAP objects: IndexError(‘list index out of range’,)
!!!Log Entry Secured by SecureFormatter!!! [2023-07-18 14:25:41,849][10598][140378531059456][ERROR][privacyidea.app:1892] Exception on /resolver/vnpt-ldap [POST]
Traceback (most recent call last):
File “/opt/privacyidea/lib/python3.5/site-packages/sqlalchemy/engine/base.py”, line 1277, in _execute_context
cursor, statement, parameters, context
File “/opt/privacyidea/lib/python3.5/site-packages/sqlalchemy/engine/default.py”, line 608, in do_execute
cursor.execute(statement, parameters)
File “/opt/privacyidea/lib/python3.5/site-packages/pymysql/cursors.py”, line 163, in execute
result = self._query(query)
File “/opt/privacyidea/lib/python3.5/site-packages/pymysql/cursors.py”, line 321, in _query
conn.query(q)
File “/opt/privacyidea/lib/python3.5/site-packages/pymysql/connections.py”, line 505, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
File “/opt/privacyidea/lib/python3.5/site-packages/pymysql/connections.py”, line 724, in _read_query_result
result.read()
File “/opt/privacyidea/lib/python3.5/site-packages/pymysql/connections.py”, line 1069, in read
first_packet = self.connection._read_packet()
File “/opt/privacyidea/lib/python3.5/site-packages/pymysql/connections.py”, line 676, in _read_packet
packet.raise_for_error()
File “/opt/privacyidea/lib/python3.5/site-packages/pymysql/protocol.py”, line 223, in raise_for_error
err.raise_mysql_exception(self._data)
File “/opt/privacyidea/lib/python3.5/site-packages/pymysql/err.py”, line 107, in raise_mysql_exception
raise errorclass(errno, errval)
pymysql.err.DataError: (1366, “Incorrect string value: ‘\xE1\xBB\x8Dc,D…’ for column ‘Value’ at row 1”)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File “/opt/privacyidea/lib/python3.5/site-packages/flask/app.py”, line 2447, in wsgi_app
response = self.full_dispatch_request()
File “/opt/privacyidea/lib/python3.5/site-packages/flask/app.py”, line 1952, in full_dispatch_request
rv = self.handle_user_exception(e)
File “/opt/privacyidea/lib/python3.5/site-packages/flask/app.py”, line 1821, in handle_user_exception
reraise(exc_type, exc_value, tb)
File “/opt/privacyidea/lib/python3.5/site-packages/flask/_compat.py”, line 39, in reraise
raise value
File “/opt/privacyidea/lib/python3.5/site-packages/flask/app.py”, line 1950, in full_dispatch_request
rv = self.dispatch_request()
File “/opt/privacyidea/lib/python3.5/site-packages/flask/app.py”, line 1936, in dispatch_request
return self.view_functionsrule.endpoint
File “/opt/privacyidea/lib/python3.5/site-packages/privacyidea/lib/log.py”, line 155, in log_wrapper
return func(*args, **kwds)
File “/opt/privacyidea/lib/python3.5/site-packages/privacyidea/api/lib/prepolicy.py”, line 155, in policy_wrapper
return wrapped_function(*args, **kwds)
File “/opt/privacyidea/lib/python3.5/site-packages/privacyidea/api/resolver.py”, line 156, in set_resolver
res = save_resolver(param)
File “/opt/privacyidea/lib/python3.5/site-packages/privacyidea/lib/log.py”, line 155, in log_wrapper
return func(*args, **kwds)
File “/opt/privacyidea/lib/python3.5/site-packages/privacyidea/lib/resolver.py”, line 140, in save_resolver
Description=desc.get(key, “”)).save()
File “/opt/privacyidea/lib/python3.5/site-packages/privacyidea/models.py”, line 1082, in save
db.session.commit()
File “/opt/privacyidea/lib/python3.5/site-packages/sqlalchemy/orm/scoping.py”, line 163, in do
return getattr(self.registry(), name)(*args, **kwargs)
File “/opt/privacyidea/lib/python3.5/site-packages/sqlalchemy/orm/session.py”, line 1046, in commit
self.transaction.commit()
File “/opt/privacyidea/lib/python3.5/site-packages/sqlalchemy/orm/session.py”, line 504, in commit
self._prepare_impl()
File “/opt/privacyidea/lib/python3.5/site-packages/sqlalchemy/orm/session.py”, line 483, in _prepare_impl
self.session.flush()
File “/opt/privacyidea/lib/python3.5/site-packages/sqlalchemy/orm/session.py”, line 2540, in flush
self._flush(objects)
File “/opt/privacyidea/lib/python3.5/site-packages/sqlalchemy/orm/session.py”, line 2682, in _flush
transaction.rollback(capture_exception=True)
File “/opt/privacyidea/lib/python3.5/site-packages/sqlalchemy/util/langhelpers.py”, line 70, in exit
with_traceback=exc_tb,
File “/opt/privacyidea/lib/python3.5/site-packages/sqlalchemy/util/compat.py”, line 182, in raise

raise exception
File “/opt/privacyidea/lib/python3.5/site-packages/sqlalchemy/orm/session.py”, line 2642, in _flush
flush_context.execute()
File “/opt/privacyidea/lib/python3.5/site-packages/sqlalchemy/orm/unitofwork.py”, line 422, in execute
rec.execute(self)
File “/opt/privacyidea/lib/python3.5/site-packages/sqlalchemy/orm/unitofwork.py”, line 589, in execute
uow,
File “/opt/privacyidea/lib/python3.5/site-packages/sqlalchemy/orm/persistence.py”, line 245, in save_obj
insert,
File “/opt/privacyidea/lib/python3.5/site-packages/sqlalchemy/orm/persistence.py”, line 1136, in _emit_insert_statements
statement, params
File “/opt/privacyidea/lib/python3.5/site-packages/sqlalchemy/engine/base.py”, line 1011, in execute
return meth(self, multiparams, params)
File “/opt/privacyidea/lib/python3.5/site-packages/sqlalchemy/sql/elements.py”, line 298, in _execute_on_connection
return connection._execute_clauseelement(self, multiparams, params)
File “/opt/privacyidea/lib/python3.5/site-packages/sqlalchemy/engine/base.py”, line 1130, in _execute_clauseelement
distilled_params,
File “/opt/privacyidea/lib/python3.5/site-packages/sqlalchemy/engine/base.py”, line 1317, in execute_context
e, statement, parameters, cursor, context
File “/opt/privacyidea/lib/python3.5/site-packages/sqlalchemy/engine/base.py”, line 1511, in handle_dbapi_exception
sqlalchemy_exception, with_traceback=exc_info[2], from
=e
File “/opt/privacyidea/lib/python3.5/site-packages/sqlalchemy/util/compat.py”, line 182, in raise

raise exception
File “/opt/privacyidea/lib/python3.5/site-packages/sqlalchemy/engine/base.py”, line 1277, in _execute_context
cursor, statement, parameters, context
File “/opt/privacyidea/lib/python3.5/site-packages/sqlalchemy/engine/default.py”, line 608, in do_execute
cursor.execute(statement, parameters)
File “/opt/privacyidea/lib/python3.5/site-packages/pymysql/cursors.py”, line 163, in execute
result = self._query(query)
File “/opt/privacyidea/lib/python3.5/site-packages/pymysql/cursors.py”, line 321, in _query
conn.query(q)
File “/opt/privacyidea/lib/python3.5/site-packages/pymysql/connections.py”, line 505, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
File “/opt/privacyidea/lib/python3.5/site-packages/pymysql/connections.py”, line 724, in _read_query_result
result.read()
File “/opt/privacyidea/lib/python3.5/site-packages/pymysql/connections.py”, line 1069, in read
first_packet = self.connection._read_packet()
File “/opt/privacyidea/lib/python3.5/site-packages/pymysql/connections.py”, line 676, in _read_packet
packet.raise_for_error()
File “/opt/privacyidea/lib/python3.5/site-packages/pymysql/protocol.py”, line 223, in raise_for_error
err.raise_mysql_exception(self._data)
File “/opt/privacyidea/lib/python3.5/site-packages/pymysql/err.py”, line 107, in raise_mysql_exception
raise errorclass(errno, errval)
sqlalchemy.exc.DataError: (pymysql.err.DataError) (1366, “Incorrect string value: ‘\xE1\xBB\x8Dc,D…’ for column ‘Value’ at row 1”)
[SQL: INSERT INTO resolverconfig (resolver_id, Key, Value, Type, Description) VALUES (%(resolver_id)s, %(Key)s, %(Value)s, %(Type)s, %(Description)s)]
[parameters: {‘resolver_id’: 2, ‘Key’: ‘LDAPBASE’, ‘Type’: ‘string’, ‘Description’: ‘’, ‘Value’: ‘OU=VNPT-Media,OU=C.c C.ng ty d.c,DC=cqtd,DC=vnpt,DC=vn’}]
(Background on this error at: Error Messages — SQLAlchemy 1.3 Documentation)

Please to help me!!!

Python 3.5 is not supported anymore.

This might actually be the reason.

tks, now i upgrade to Ubuntu22 with Python1.10, its ok.

1 Like