ome / omero-web

Django-based OMERO.web client
https://www.openmicroscopy.org/omero
17 stars 31 forks source link

TypeError: type object argument after ** must be a mapping, not Connector #459

Closed gaelrayot-epfl closed 1 year ago

gaelrayot-epfl commented 1 year ago

After upgrading from OMERO.Web 5.16 to 5.19, when accessing the login page from the public space, The app fail with the following stack trace

2023-04-21 07:55:50,590 ERROR [                     omeroweb.decorators] (proc.105175) wrapped():513 Error retrieving connection.
Traceback (most recent call last):
  File "/opt/omero/web/venv3/lib64/python3.6/site-packages/omeroweb/decorators.py", line 511, in wrapped
    conn = ctx.get_connection(server_id, request)
  File "/opt/omero/web/venv3/lib64/python3.6/site-packages/omeroweb/decorators.py", line 329, in get_connection
    connection = self.get_authenticated_connection(server_id, request)
  File "/opt/omero/web/venv3/lib64/python3.6/site-packages/omeroweb/decorators.py", line 404, in get_authenticated_connection
    connector = Connector.from_session(request)
  File "/opt/omero/web/venv3/lib64/python3.6/site-packages/omeroweb/connector.py", line 284, in from_session
    return Connector(**v)
TypeError: type object argument after ** must be a mapping, not Connector
2023-04-21 07:55:50,591 ERROR [                 omeroweb.feedback.views] (proc.105175) handler500():195 handler500: Server error
2023-04-21 07:55:50,591 ERROR [                 omeroweb.feedback.views] (proc.105175) handler500():198 Traceback (most recent call last):

  File "/opt/omero/web/venv3/lib64/python3.6/site-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)

  File "/opt/omero/web/venv3/lib64/python3.6/site-packages/django/core/handlers/base.py", line 181, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)

  File "/opt/omero/web/venv3/lib64/python3.6/site-packages/omeroweb/decorators.py", line 538, in wrapped
    retval = f(request, *args, **kwargs)

  File "/opt/omero/web/venv3/lib64/python3.6/site-packages/omeroweb/decorators.py", line 597, in wrapper
    context = f(request, *args, **kwargs)

  File "/opt/omero/web/venv3/lib64/python3.6/site-packages/omeroweb/webclient/views.py", line 575, in load_template
    return _load_template(request=request, menu=menu, conn=conn, url=url, **kwargs)

  File "/opt/omero/web/venv3/lib64/python3.6/site-packages/omeroweb/webclient/views.py", line 493, in _load_template
    active_group = request.session.get("active_group") or conn.getEventContext().groupId

AttributeError: 'NoneType' object has no attribute 'getEventContext'
sbesson commented 1 year ago

@gaelrayot-epfl thanks for the bug report as well as the proposed fix. It looks like an unexpected outcome of the serialization changes introduced in https://github.com/ome/omero-web/pull/435.

As there are multiple configurations to consider here, could you tell us the values of omero.web.session_engine, omero.web.session_serializer and possibly omero.web.caches in your deployment?

gaelrayot-epfl commented 1 year ago

omero.web.caches={"default": {"BACKEND": "django_redis.cache.RedisCache", "LOCATION": "redis://127.0.0.1:6379/0"}}

omero.web.session_engine=django.contrib.sessions.backends.cache

Regarding omero.web.session_serializer, nothing's defined.