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: non confirmed users fail to be confirmed #2637

Open
zzacharo opened this issue Apr 5, 2024 · 0 comments
Open

v12-upgrade: non confirmed users fail to be confirmed #2637

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.0b3.x

Describe the bug

When upgrading to v12, non-confirmed users will fail to be confirmed, because of the domain column being null.

Expected behavior

User domain should be not required or otherwise an upgrade recipe should be created as part of upgrading to v12. The exact failure happens when the domain is being created automatically from the user.domain here.

Additional context

Associated exception

TypeError: 'NoneType' object is not subscriptable
  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_cors/extension.py", line 176, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
  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 "flask_resources/resources.py", line 65, in view
    return view_meth()
  File "flask_resources/content_negotiation.py", line 116, in inner_content_negotiation
    return f(*args, **kwargs)
  File "flask_resources/parsers/decorators.py", line 51, in inner
    return f(self, *args, **kwargs)
  File "invenio_users_resources/resources/users/resource.py", line 140, in activate
    self.service.activate(
  File "invenio_records_resources/services/uow.py", line 350, in inner
    res = f(self, *args, **kwargs)
  File "invenio_users_resources/services/users/service.py", line 230, in activate
    user.activate()
  File "invenio_users_resources/records/api.py", line 247, in activate
    return current_datastore.activate_user(user)
  File "invenio_accounts/datastore.py", line 51, in activate_user
    user_confirmed.send(current_app._get_current_object(), user=user)
  File "blinker/base.py", line 307, in send
    result = receiver(sender, **kwargs)
  File "invenio_accounts/domains.py", line 22, in on_user_confirmed
    domain = datastore.create_domain(user.domain)
  File "invenio_accounts/datastore.py", line 123, in create_domain
    return Domain.create(domain, **kwargs)
  File "invenio_accounts/models.py", line 615, in create
    obj = cls(
  File "<string>", line 4, in __init__
  File "sqlalchemy/orm/state.py", line 482, in _initialize_instance
    manager.dispatch.init_failure(self, args, kwargs)
  File "sqlalchemy/util/langhelpers.py", line 70, in __exit__
    compat.raise_(
  File "sqlalchemy/util/compat.py", line 211, in raise_
    raise exception
  File "sqlalchemy/orm/state.py", line 479, in _initialize_instance
    return manager.original_init(*mixed[1:], **kwargs)
  File "sqlalchemy/orm/decl_base.py", line 1200, in _declarative_constructor
    setattr(self, k, kwargs[k])
  File "sqlalchemy/ext/hybrid.py", line 938, in __set__
    self.fset(instance, value)
  File "invenio_accounts/models.py", line 634, in domain
    if value[-1] == ".":
@zzacharo zzacharo added the bug Something isn't working label 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