#User write ValueError exception raised.

1 messages · Page 1 of 1 (latest)

cloud sentinel
#

Hello I'm trying to enroll users via invitation. During flow my stages work as expected.

  1. Invitation.
  2. Prompt.
  3. User Write Fails traceback below

I have a couple of policies attached to the prompt. One sets the username as email my other one sets groups based on the invitation link.
However I keep getting this failure. Should be known that I accidently deleted all groups earlier and restored them according to the documentation.

Traceback (most recent call last): File "/authentik/flows/views/executor.py", line 296, in get stage_response = self.current_stage_view.get(request, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/authentik/stages/user_write/stage.py", line 140, in get self.update_user(user) File "/authentik/stages/user_write/stage.py", line 97, in update_user elif hasattr(user, key) and not key.startswith("attributes."): ^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/django/db/models/fields/related_descriptors.py", line 588, in __get__ return self.related_manager_cls(instance) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/django/db/models/fields/related_descriptors.py", line 974, in __init__ raise ValueError( builtins.ValueError: "<User: >" needs to have a value for field "id" before this many-to-many relationship can be used.

ornate rapids
#

which fields are you attempting to set with the prompt stage?

cloud sentinel
#

@ornate rapids at the prompt stage I had a groups prompt as read only input. I've solved the issue by placing a policy before the user write that removes the prompt then sets the flow_plan for user write. Thanks for replying!