Problem/Motivation
After upgrading to 8.x-1.3 from 8.x-1.1, we're getting this error on our homepage on a test instance. If I flush all caches the page will load normally, but it comes back if the user logs out and back in. From what I can tell, there's no group content on the page, so I'm not sure why this page is throwing an error from this module. Any help or pointers would be greatly appreciated.
TypeError: Argument 2 passed to Drupal\group\Entity\Storage\GroupRoleStorage::loadByUserAndGroup() must implement interface Drupal\group\Entity\GroupInterface, null given, called in /code/web/modules/contrib/group/src/GroupMembership.php on line 78 in Drupal\group\Entity\Storage\GroupRoleStorage->loadByUserAndGroup() (line 101 of /code/web/modules/contrib/group/src/Entity/Storage/GroupRoleStorage.php)
#0 /code/web/modules/contrib/group/src/GroupMembership.php(78): Drupal\group\Entity\Storage\GroupRoleStorage->loadByUserAndGroup(Object(Drupal\user\Entity\User), NULL)
#1 /code/web/modules/contrib/group/src/Access/DefaultGroupPermissionCalculator.php(123): Drupal\group\GroupMembership->getRoles()
#2 [internal function]: Drupal\group\Access\DefaultGroupPermissionCalculator->calculateMemberPermissions(Object(Drupal\Core\Session\AccountProxy))
#3 /code/web/modules/contrib/group/src/Access/ChainGroupPermissionCalculator.php(147): call_user_func_array(Array, Array)
#4 /code/web/modules/contrib/group/src/Access/ChainGroupPermissionCalculator.php(206): Drupal\group\Access\ChainGroupPermissionCalculator->doCacheableCalculation(Array, Array, 'calculateMember...', Array)
#5 /code/web/modules/contrib/group/src/Access/ChainGroupPermissionCalculator.php(273): Drupal\group\Access\ChainGroupPermissionCalculator->calculateMemberPermissions(Object(Drupal\Core\Session\AccountProxy))
#6 /code/web/modules/contrib/group/src/Access/ChainGroupPermissionCalculator.php(283): Drupal\group\Access\ChainGroupPermissionCalculator->calculateAuthenticatedPermissions(Object(Drupal\Core\Session\AccountProxy))
#7 /code/web/modules/contrib/group/src/Access/GroupPermissionsHashGenerator.php(108): Drupal\group\Access\ChainGroupPermissionCalculator->calculatePermissions(Object(Drupal\Core\Session\AccountProxy))
#8 /code/web/modules/contrib/group/src/Cache/Context/GroupPermissionsCacheContext.php(66): Drupal\group\Access\GroupPermissionsHashGenerator->getCacheableMetadata(Object(Drupal\Core\Session\AccountProxy))
#9 /code/web/core/lib/Drupal/Core/Cache/Context/CacheContextsManager.php(179): Drupal\group\Cache\Context\GroupPermissionsCacheContext->getCacheableMetadata(NULL)
#10 /code/web/core/lib/Drupal/Core/Cache/Context/CacheContextsManager.php(105): Drupal\Core\Cache\Context\CacheContextsManager->optimizeTokens(Array)
#11 /code/web/core/lib/Drupal/Core/Render/RenderCache.php(307): Drupal\Core\Cache\Context\CacheContextsManager->convertTokensToKeys(Array)
#12 /code/web/core/lib/Drupal/Core/Render/RenderCache.php(66): Drupal\Core\Render\RenderCache->createCacheID(Array)
#13 /code/web/core/lib/Drupal/Core/Render/PlaceholderingRenderCache.php(109): Drupal\Core\Render\RenderCache->get(Array)
#14 /code/web/core/lib/Drupal/Core/Render/RenderCache.php(77): Drupal\Core\Render\PlaceholderingRenderCache->get(Array)
#15 /code/web/core/lib/Drupal/Core/Render/PlaceholderingRenderCache.php(109): Drupal\Core\Render\RenderCache->get(Array)
#16 /code/web/core/modules/dynamic_page_cache/src/EventSubscriber/DynamicPageCacheSubscriber.php(137): Drupal\Core\Render\PlaceholderingRenderCache->get(Array)
#17 [internal function]: Drupal\dynamic_page_cache\EventSubscriber\DynamicPageCacheSubscriber->onRequest(Object(Symfony\Component\HttpKernel\Event\GetResponseEvent), 'kernel.request', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher))
#18 /code/web/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(111): call_user_func(Array, Object(Symfony\Component\HttpKernel\Event\GetResponseEvent), 'kernel.request', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher))
#19 /code/vendor/symfony/http-kernel/HttpKernel.php(127): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('kernel.request', Object(Symfony\Component\HttpKernel\Event\GetResponseEvent))
#20 /code/vendor/symfony/http-kernel/HttpKernel.php(68): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#21 /code/web/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#22 /code/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#23 /code/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#24 /code/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#25 /code/web/core/modules/ban/src/BanMiddleware.php(50): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#26 /code/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\ban\BanMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#27 /code/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(52): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#28 /code/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#29 /code/web/core/lib/Drupal/Core/DrupalKernel.php(708): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#30 /code/web/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#31 {main}