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

v12-upgrade: community gives 500 if existing members have not set verified_at #2638

Open
zzacharo opened this issue Apr 5, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@zzacharo
Copy link
Member

zzacharo commented Apr 5, 2024

Package version (if known): v12.0.0.0b3.x

Describe the bug

WHen upgrading to v12, existing users haven't set the verified_at property. This leads to community page being broken.

Expected behavior

Add script to update all users, with a verified_at={True, False} as part of the upgrade script.

Additional context

Relevant stacktrace

KeyError: 'is_verified'
  File "marshmallow/utils.py", line 293, in _get_value_for_key
    return obj[key]
KeyError: 'user'
  File "flask/app.py", line 2529, in wsgi_app
    response = self.full_dispatch_request()
  File "flask/app.py", line 1825, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "flask/app.py", line 1823, in full_dispatch_request
    rv = self.dispatch_request()
  File "flask/app.py", line 1799, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
  File "invenio_communities/views/decorators.py", line 32, in view
    request.community = community.to_dict()
  File "invenio_communities/communities/services/results.py", line 116, in to_dict
    res = self.data
  File "invenio_records_resources/services/records/results.py", line 71, in data
    self._data = self._schema.dump(
  File "invenio_records_resources/services/records/schema.py", line 105, in dump
    return self.schema(context=context, **schema_args).dump(data)
  File "marshmallow/schema.py", line 549, in dump
    result = self._serialize(processed_obj, many=many)
  File "marshmallow/schema.py", line 517, in _serialize
    value = field_obj.serialize(attr_name, obj, accessor=self.get_attribute)
  File "marshmallow/fields.py", line 332, in serialize
    value = self.get_value(obj, attr, accessor=accessor)
  File "marshmallow/fields.py", line 263, in get_value
    return accessor_func(obj, check_key, default)
  File "marshmallow/schema.py", line 476, in get_attribute
    return get_value(obj, attr, default)
  File "marshmallow/utils.py", line 276, in get_value
    return _get_value_for_key(obj, key, default)
  File "marshmallow/utils.py", line 295, in _get_value_for_key
    return getattr(obj, key, default)
  File "invenio_records_resources/records/systemfields/calculated.py", line 47, in __get__
    return self.obj(record)
  File "invenio_records_resources/records/systemfields/calculated.py", line 29, in obj
    return self.calculate(instance)
  File "invenio_communities/communities/records/systemfields/is_verified.py", line 28, in calculate
    if owner["user"]["verified_at"] is not None:
@zzacharo zzacharo added the bug Something isn't working label Apr 5, 2024
@zzacharo zzacharo changed the title v12-upgrade: community results in 500 if existing members have not set verified_at v12-upgrade: community gives 500 if existing members have not set verified_at Apr 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant