1 (edited by santiago.miguel 2025-07-17 15:52:57)

Topic: REST API /api/users return a 500 error

==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release):
- Deployed with iRedMail Easy or the downloadable installer?
- Linux/BSD distribution name and version:
- Store mail accounts in which backend (LDAP/MySQL/PGSQL):
- Web server (Apache or Nginx):
- Manage mail accounts with iRedAdmin-Pro?
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====
iRedMail version: 1.7.4
Downloaded installation
Linux: Ubuntu 24.04.1 LTS
Store mail: MySQL
Web Server: Nginx
I've got iRedAdmin-Pro

An error produced on practically all domains from api with route /api/users/<domain>

    'http_code' => 500,
    'Curl_return' => 'internal server error'

When we call the API to obtain the aliases it works fine, only the call to users doesn't work. Could you help us to find where could be the error?

Regards.

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: REST API /api/users return a 500 error

Could you share the code so that i can reproduce the issue?

3

Re: REST API /api/users return a 500 error

ZhangHuangbin wrote:

Could you share the code so that i can reproduce the issue?

Yes it's a simple call with curl I've attached the image with the curl.

at /tmp/cookie.txt I've got the authentication token.

Regards,
Santi.

4

Re: REST API /api/users return a 500 error

In the /var/log/syslog file, I have the following error, which might help you determine where the error might be.

2025-07-20T06:14:45.096657+00:00 smtp iredadmin: Traceback (most recent call last):#012  File "/opt/www/iRedAdmin-Pro-SQL-5.7.1/web/application.py", line 277, in process#012    return self.handle()#012           ^^^^^^^^^^^^^#012  File "/opt/www/iRedAdmin-Pro-SQL-5.7.1/web/application.py", line 268, in handle#012    return self._delegate(fn, self.fvars, args)#012           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^#012  File "/opt/www/iRedAdmin-Pro-SQL-5.7.1/web/application.py", line 510, in _delegate#012    return handle_class(cls)#012           ^^^^^^^^^^^^^^^^^#012  File "/opt/www/iRedAdmin-Pro-SQL-5.7.1/web/application.py", line 488, in handle_class#012   return tocall(*args)#012           ^^^^^^^^^^^^^#012  File "/opt/www/iRedAdmin-Pro-SQL-5.7.1/libs/sqllib/decorators.py", line 152, in proxyfunc#012    return func(*args, **kw)#012           ^^^^^^^^^^^^^^^^^#012  File "/opt/www/iRedAdmin-Pro-SQL-5.7.1/controllers/sql/api_user.py", line 184, in GET#012    return api_render((True, profiles))#012           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^#012  File "/opt/www/iRedAdmin-Pro-SQL-5.7.1/controllers/utils.py", line 67, in api_render#012    return _render_json(d)#012           ^^^^^^^^^^^^^^^#012  File "/opt/www/iRedAdmin-Pro-SQL-5.7.1/controllers/utils.py", line 34, in _render_json#012    return json.dumps(d)#012           ^^^^^^^^^^^^^#012  File "/usr/lib/python3/dist-packages/simplejson/__init__.py", line 378, in dumps#012    return _default_encoder.encode(obj)#012           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^#012  File "/usr/lib/python3/dist-packages/simplejson/encoder.py", line 298, in encode#012    chunks = self.iterencode(o)#012     ^^^^^^^^^^^^^^^^^^#012  File "/usr/lib/python3/dist-packages/simplejson/encoder.py", line 379, in iterencode#012    return _iterencode(o, 0)#012           ^^^^^^^^^^^^^^^^^#012  File "/usr/lib/python3/dist-packages/simplejson/encoder.py", line 274, in default#012    raise TypeError('Object of type %s is not JSON serializable' %#012TypeError: Object of type date is not JSON serializable#012#012Traceback (most recent call last):#012 File "/opt/www/iRedAdmin-Pro-SQL-5.7.1/web/application.py", line 277, in process#012    return self.handle()#012           ^^^^^^^^^^^^^#012  File "/opt/www/iRedAdmin-Pro-SQL-5.7.1/web/application.py", line 268, in handle#012    return self._delegate(fn, self.fvars, args)#012           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^#012File "/opt/www/iRedAdmin-Pro-SQL-5.7.1/web/application.py", line 510, in _delegate#012    return handle_class(cls)#012           ^^^^^^^^^^^^^^^^^#012  File "/opt/www/iRedAdmin-Pro-SQL-5.7.1/web/application.py", line 488, in handle_class#012    return tocall(*args)#012           ^^^^^^^^^^^^^#012  File "/opt/www/iRedAdmin-Pro-SQL-5.7.1/libs/sqllib/decorators.py", line 152, in proxyfunc#012    return func(*args, **kw)#012           ^^^^^^^^^^^^^^^^^#012  File "/opt/www/iRedAdmin-Pro-SQL-5.7.1/controllers/sql/api_user.py", line 184, in GET#012 return api_render((True, profiles))#012           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^#012  File "/opt/www/iRedAdmin-Pro-SQL-5.7.1/controllers/utils.py", line 67, in api_render#012    return _render_json(d)#012           ^^^^^^^^^^^^^^^#012  File "/opt/www/iRedAdmin-Pro-SQL-5.7.1/controllers/utils.py", line 34, in _render_json#012    return json.dumps(d)#012           ^^^^^^^^^^^^^#012  File "/usr/lib/python3/dist-packages/simplejson/__init__.py", line 378, in dumps#012    return _default_encoder.encode(obj)#012           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^#012  File "/usr/lib/python3/dist-packages/simplejson/encoder.py", line 298, in encode#012    chunks = self.iterencode(o)#012             ^^^^^^^^^^^^^^^^^^#012  File "/usr/lib/python3/dist-packages/simplejson/encoder.py", line 379, in iterencode#012    return _iterencode(o, 0)#012           ^^^^^^^^^^^^^^^^^#012  File "/usr/lib/python3/dist-packages/simplejson/encoder.py", line 274, in default#012    raise TypeError('Object of type %s is not JSON serializable' %#012TypeError: Object of type date is not JSON serializable#012#012Traceback (most recent call last):#012  File "/opt/www/iRedAdmin-Pro-SQL-5.7.1/web/application.py", line 277, in process#012 return self.handle()#012           ^^^^^^^^^^^^^#012  File "/opt/www/iRedAdmin-Pro-SQL-5.7.1/web/application.py", line 268, in handle#012    return self._delegate(fn, self.fvars, args)#012           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^#012  File "/opt/www/iRedAdmin-Pro-SQL-5.7.1/web/application.py", line 510, in _delegate#012  return handle_class(cls)#012           ^^^^^^^^^^^^^^^^^#012  File "/opt/www/iRedAdmin-Pro-SQL-5.7.1/web/application.py", line 488, in handle_class#012    return tocall(*args)#012           ^^^^^^^^^^^^^#012  File "/opt/www/iRedAdmin-Pro-SQL-5.7.1/libs/sqllib/decorators.py", line 152, in proxyfunc#012    return func(*args, **kw)#012           ^^^^^^^^^^^^^^^^^#012  File "/opt/www/iRedAdmin-Pro-SQL-5.7.1/controllers/sql/api_user.py", line 184, in GET#012  File "/opt/www/iRedAdmin-Pro-SQL-5.7.1/controllers/utils.py", line 67, in api_render#012   return _render_json(d)#012           ^^^^^^^^^^^^^^^#012  File "/opt/www/iRedAdmin-Pro-SQL-5.7.1/controllers/utils.py", line 34, in _render_json#012    return json.dumps(d)#012           ^^^^^^^^^^^^^#012  File "/usr/lib/python3/dist-packages/simplejson/__init__.py", line 378, in dumps#012    return _default_encoder.encode(obj)#012           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^#012  File "/usr/lib/python3/dist-packages/simplejson/encoder.py", line 298, in encode#012    chunks = self.iterencode(o)#012             ^^^^^^^^^^^^^^^^^^#012  File "/usr/lib/python3/dist-packages/simplejson/encoder.py", line 379, in iterencode#012    return _iterencode(o, 0)#012        ^^^^^^^^^^^^^^^^^#012  File "/usr/lib/python3/dist-packages/simplejson/encoder.py", line 274, in default#012    raise TypeError('Object of type %s is not JSON serializable' %#012TypeError: Object of type date isnot JSON serializable#012#012Traceback (most recent call last):#012  File "/opt/www/iRedAdmin-Pro-SQL-5.7.1/web/application.py", line 277, in process#012    return self.handle()#012           ^^^^^^^^^^^^^#012  File "/opt/www/iRedAdmin-Pro-SQL-5.7.1/web/application.py", line 268, in handle#012    return self._delegate(fn, self.fvars, args)#012           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^#012  File "/opt/www/iRedAdmin-Pro-SQL-5.7.1/web/application.py", line 510, in _delegate#012    return handle_class(cls)#012           ^^^^^^^^^^^^^^^^^#012File "/opt/www/iRedAdmin-Pro-SQL-5.7.1/web/application.py", line 488, in handle_class#012    return tocall(*args)#012           ^^^^^^^^^^^^^#012  File "/opt/www/iRedAdmin-Pro-SQL-5.7.1/libs/sqllib/decorators.py", line 152, in proxyfunc#012    return func(*args, **kw)#012           ^^^^^^^^^^^^^^^^^#012  File "/opt/www/iRedAdmin-Pro-SQL-5.7.1/controllers/sql/api_user.py", line 184, in GET#012    disabled_only = ('disabled_only' in form)#012                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^#012  File "/opt/www/iRedAdmin-Pro-SQL-5.7.1/controllers/utils.py", line 67, in api_render#012    return _render_json(d)#012           ^^^^^^^^^^^^^^^#012  File "/opt/www/iRedAdmin-Pro-SQL-5.7.1/controllers/utils.py", line 34, in _render_json#012    return json.dumps(d)#012     ^^^^^^^^^^^^^#012  File "/usr/lib/python3/dist-packages/simplejson/__init__.py", line 378, in dumps#012  return _default_encoder.encode(obj)#012           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^#012  File "/usr/lib/python3/dist-packages/simplejson/encoder.py", line 298, in encode#012    chunks = self.iterencode(o)#012             ^^^^^^^^^^^^^^^^^^#012  File "/usr/lib/python3/dist-packages/simplejson/encoder.py", line 379, in iterencode#012    return _iterencode(o, 0)#012           ^^^^^^^^^^^^^^^^^#012  File "/usr/lib/python3/dist-packages/simplejson/encoder.py", line 274, in default#012    raise TypeError('Object of type %s is not JSON serializable' %#012TypeError: Object of type date is not JSON serializable#012

Regards,
Santi.

5

Re: REST API /api/users return a 500 error

Is mlmmjadmin service running?