Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
gaelrayot-epfl opened this issue Apr 25, 2023 · 2 comments · Fixed by #492
Closed

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

gaelrayot-epfl opened this issue Apr 25, 2023 · 2 comments · Fixed by #492

Comments

@gaelrayot-epfl
Copy link

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'
gaelrayot-epfl added a commit to gaelrayot-epfl/omero-web that referenced this issue Apr 25, 2023
In some race condition, seems the session.get return the Connector instance, not a serialize version of the instance.

Fix ome#459
@sbesson
Copy link
Member

sbesson commented Apr 25, 2023

@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 #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
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants