Problem/Motivation

Using Group 3.3.4, Core 10.4.2, Group Invite 4.0.0

Invite member by email without a user account, invite email sent successfully with link to create new account. Complete and the following
WSOD error is displayed:

Drupal\Core\Entity\EntityStorageException: Update existing 'group_relationship' entity while changing the ID is not supported. in Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (line 817 of core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).

Stack Trace:
Drupal\Core\Entity\EntityStorageBase->save() (Line: 806)
Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (Line: 354)
Drupal\Core\Entity\EntityBase->save() (Line: 170)
Drupal\ginvite\EventSubscriber\GinviteSubscriber->autoAcceptGroupInvitation()
call_user_func() (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch() (Line: 327)
_ginvite_handle_new_user_registration_or_update() (Line: 274)
ginvite_user_insert()
call_user_func_array() (Line: 416)
Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}() (Line: 395)
Drupal\Core\Extension\ModuleHandler->invokeAllWith() (Line: 415)
Drupal\Core\Extension\ModuleHandler->invokeAll() (Line: 215)
Drupal\Core\Entity\EntityStorageBase->invokeHook() (Line: 900)
Drupal\Core\Entity\ContentEntityStorageBase->invokeHook() (Line: 564)
Drupal\Core\Entity\EntityStorageBase->doPostSave() (Line: 781)
Drupal\Core\Entity\ContentEntityStorageBase->doPostSave() (Line: 489)
Drupal\Core\Entity\EntityStorageBase->save() (Line: 806)
Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (Line: 354)
Drupal\Core\Entity\EntityBase->save() (Line: 100)
Drupal\user\RegisterForm->save()
call_user_func_array() (Line: 129)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers() (Line: 67)
Drupal\Core\Form\FormSubmitter->doSubmitForm() (Line: 597)
Drupal\Core\Form\FormBuilder->processForm() (Line: 326)
Drupal\Core\Form\FormBuilder->buildForm() (Line: 73)
Drupal\Core\Controller\FormController->getContentResult() (Line: 39)
Drupal\layout_builder\Controller\LayoutBuilderHtmlEntityFormController->getContentResult()
call_user_func_array() (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 638)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 121)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 181)
Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 53)
Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle() (Line: 32)
Drupal\big_pipe\StackMiddleware\ContentLength->handle() (Line: 116)
Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 90)
Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 36)
Drupal\Core\StackMiddleware\AjaxPageState->handle() (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 741)
Drupal\Core\DrupalKernel->handle() (Line: 19)

Steps to reproduce

  • As user 1, Created Group, Invite new user to the group. Invite member with email address
  • invite email sent successfully with link to create new account.
  • The link opens the account creation screen. When the Create new account is clicked the WSOD message appears.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Issue fork ginvite-3498322

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

bsnodgrass created an issue. See original summary.

bsnodgrass’s picture

Issue summary: View changes
bsnodgrass’s picture

Issue summary: View changes
lobsterr’s picture

Status: Active » Postponed (maintainer needs more info)

I have tested it and I couldn't not reproduce. Have you tried to debug it deeper or try on the fresh instance ?

BTW You have to use a link with hash code and not with email.

bsnodgrass’s picture

Thank you... I will be looking at this later today/tomorrow and dig into troubleshooting a little deeper

chesterb’s picture

I'm getting the same message and not able to create any new users any more.

Drupal\Core\Entity\EntityStorageException: Update existing 'group_relationship' entity while changing the ID is not supported. in Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (line 817 of /home/interp/domains/domain.com/public_html/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).

#0 /home/interp/domains/domain.com/public_html/web/core/lib/Drupal/Core/Entity/EntityBase.php(354): Drupal\Core\Entity\Sql\SqlContentEntityStorage->save()
#1 /home/interp/domains/domain.com/public_html/web/core/modules/user/src/RegisterForm.php(100): Drupal\Core\Entity\EntityBase->save()
#2 [internal function]: Drupal\user\RegisterForm->save()
#3 /home/interp/domains/domain.com/public_html/web/core/lib/Drupal/Core/Form/FormSubmitter.php(129): call_user_func_array()
#4 /home/interp/domains/domain.com/public_html/web/core/lib/Drupal/Core/Form/FormSubmitter.php(67): Drupal\Core\Form\FormSubmitter->executeSubmitHandlers()
#5 /home/interp/domains/domain.com/public_html/web/core/lib/Drupal/Core/Form/FormBuilder.php(597): Drupal\Core\Form\FormSubmitter->doSubmitForm()
#6 /home/interp/domains/domain.com/public_html/web/core/lib/Drupal/Core/Form/FormBuilder.php(326): Drupal\Core\Form\FormBuilder->processForm()
#7 /home/interp/domains/domain.com/public_html/web/core/lib/Drupal/Core/Controller/FormController.php(73): Drupal\Core\Form\FormBuilder->buildForm()
#8 [internal function]: Drupal\Core\Controller\FormController->getContentResult()
#9 /home/interp/domains/domain.com/public_html/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array()
#10 /home/interp/domains/domain.com/public_html/web/core/lib/Drupal/Core/Render/Renderer.php(638): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#11 /home/interp/domains/domain.com/public_html/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(121): Drupal\Core\Render\Renderer->executeInRenderContext()
#12 /home/interp/domains/domain.com/public_html/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext()
#13 /home/interp/domains/domain.com/public_html/vendor/symfony/http-kernel/HttpKernel.php(181): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#14 /home/interp/domains/domain.com/public_html/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw()
#15 /home/interp/domains/domain.com/public_html/web/core/lib/Drupal/Core/StackMiddleware/Session.php(53): Symfony\Component\HttpKernel\HttpKernel->handle()
#16 /home/interp/domains/domain.com/public_html/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle()
#17 /home/interp/domains/domain.com/public_html/web/core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle()
#18 /home/interp/domains/domain.com/public_html/web/core/modules/big_pipe/src/StackMiddleware/ContentLength.php(32): Drupal\Core\StackMiddleware\ContentLength->handle()
#19 /home/interp/domains/domain.com/public_html/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(116): Drupal\big_pipe\StackMiddleware\ContentLength->handle()
#20 /home/interp/domains/domain.com/public_html/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(90): Drupal\page_cache\StackMiddleware\PageCache->pass()
#21 /home/interp/domains/domain.com/public_html/web/core/modules/ban/src/BanMiddleware.php(50): Drupal\page_cache\StackMiddleware\PageCache->handle()
#22 /home/interp/domains/domain.com/public_html/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\ban\BanMiddleware->handle()
#23 /home/interp/domains/domain.com/public_html/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
#24 /home/interp/domains/domain.com/public_html/web/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(36): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
#25 /home/interp/domains/domain.com/public_html/web/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\AjaxPageState->handle()
#26 /home/interp/domains/domain.com/public_html/web/core/lib/Drupal/Core/DrupalKernel.php(741): Drupal\Core\StackMiddleware\StackedHttpKernel->handle()
#27 /home/interp/domains/domain.com/public_html/web/index.php(19): Drupal\Core\DrupalKernel->handle()
#28 {main}

What I did was inviting a new member to a group as adminstrator of the website while as was no admin for the group itself.

When I added myself also as group admin, it worked again and I was able to invite new members again.

bsnodgrass’s picture

I had to set this aside before, however I will be picking it back up again, I don't recall if I had a group admin when I got this error or not. I will be able to confirm that later today.

lobsterr’s picture

I tried both options with admins and without. It works for me. I wonder what version of Drupal do you use ?

bsnodgrass’s picture

Version: 4.0.0-rc3 » 4.0.0
Issue summary: View changes

I tried this both ways; with and without a group admin, inviting a new user to the group and site. I get the same failure each time.

Using core 10.4.2, group 3.3.4, Group invite 4.0.0. We also are using Gin Login 2.1.3 and Legal 3.0.3.

User account settings include; allow visitors to create accounts, but administrator approval is required, and email verification is required for visitors to create an account.

Inviting a new user from the group invite, sends the "you have been invited" email. The link opens the account creation screen. When the Create new account is clicked the WSOD message appears.

The email with account details and the one time login is sent. Using this link presents an access denied screen. The user account is never created.

Updated Issue Summary.

chesterb’s picture

I'm getting the same error on D10.4.3 with PHP 8.3 and Group Invite 4.0.0. It looks as if the e-mail address used to sent the invitation to, can not be used to create a new member after clicking the invitation link or manually.

I tried to create the invitee manualy (people --> add user) but again I'm getting the same error. Once I removed the invitee from the invitee list, I was able to create the new member and add her as an existing member to the group.

dabley’s picture

I am getting the same error message, although for me it occurs even for users with an existing account. I send an invite as a group admin (not a system administrator).
I find that a user without an account is able to create an account successfully. Then they get sent a one-time login link. As soon as the user clicks the Log In button, the error appears.
For users who already have an account, the error appears as soon as they log in after receiving the invite email.

After getting the error screen, if the user then navigates to their profile page (e.g. by clicking the Back button), a message appears saying "You have accepted the invitation.", and the user has indeed been added to the group.

The logs show the error twice: it is reported by php as:

Drupal\Core\Entity\EntityStorageException: Update existing 'group_relationship' entity while changing the ID is not supported. in Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (line 817 of /home/david/Websites/Southmedia/animaphonics/site/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).

And it is reported by group_relationship as:

Drupal\Core\Entity\EntityStorageException: Update existing 'group_relationship' entity while changing the ID is not supported. in Drupal\Core\Entity\ContentEntityStorageBase->doPreSave() (line 759 of /home/david/Websites/Southmedia/animaphonics/site/web/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php).

I'm using Drupal 10.4.4, group 3.3.4 and group_invite 4.0.0.

dabley’s picture

The workaround for this is to disable the "Automatically accept invitation" (autoaccept_invitees) option on the "Configure content plugin" page for the Group Invitation plugin for the group type.

chesterb’s picture

@dabley, Thanks in my case that was half the solution. Registring after clicking the invite link now works and the new member is shown a link to the pending invitations view (user/group-invitations). But there the invitation doesn't show.

As an admin, I can see the invitation but after clicking the accept or decline link, I get the message "You are not authorized to access this page".

And:

Path: /ginvite/158/accept?destination=/admin/structure/views/view/my_invitations/preview/page_1%3F_wrapper_format%3Ddrupal_ajax. Drupal\Core\Http\Exception\CacheableAccessDeniedHttpException: in Drupal\Core\Routing\AccessAwareRouter->checkAccess() (line 117 of /home/interp/domains/domain.org/public_html/web/core/lib/Drupal/Core/Routing/AccessAwareRouter.php).

Looks like a permission thing but I can't figure out what it is yet.

dabley’s picture

@chesterb yes, I also found that the pending invitations view (user/group-invitations) didn't show anything. This is a permissions issue. I had to create a new group role "non-member", link this to the "Authenticated User" system role, and then grant this role the permission to view invitations. Fairly simple to do, but not obvious - it took me a few hours to work out what I needed to do.

minoroffense’s picture

We ran into this issue today too. The workaround steps appear to work.

neptune-dc’s picture

We have this issue too. Working with the latest version of the module on Drupal 11.2.5.

It is unfortunate because the workaround adds steps to the registration process that we would rather avoid.

lobsterr’s picture

Assigned: Unassigned » lobsterr
Status: Postponed (maintainer needs more info) » Active

I have found how to reproduce it and how to fix it.

To reproduce it you need enable "Automatically accept invitation" and "Remove invitation" options

  • lobsterr committed 0e7d9ccb on 4.0.x
    Issue #3498322: Change the order of user creation to avoid group...

  • lobsterr committed 5dddd7cf on 3.0.x
    [#3498322] feat: Invite Member without a user account fails with Error...

  • lobsterr committed 81c29334 on 2.x
    [#3498322] feat: Invite Member without a user account fails with Error...
lobsterr’s picture

Assigned: lobsterr » Unassigned
Status: Active » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

lobsterr’s picture

Thank you for your contribution, I will tag a new version

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.