Customer Pages Show Error Whenever Suggested Events Are Supposed to Be Shown

Created on 26 August 2020, over 4 years ago
Updated 6 April 2023, over 1 year ago

Problem/Motivation

When logged in as a customer, Intercept does not load several pages correctly, instead showing to the user the error:
The website encountered an unexpected error. Please try again later.

This seems to occur whenever Intercept is redirecting the page to suggested events (/home; /events).

The following error is recorded in the logs:

-----

Error: Call to a member function getValue() on null in Drupal\intercept_event\SuggestedEventsProvider->getSuggestedEventIds() (line 124 of /var/www/drupal8/web/modules/contrib/intercept/modules/intercept_event/src/SuggestedEventsProvider.php)

#0 /var/www/drupal8/web/modules/contrib/intercept/modules/intercept_event/src/Controller/EventsController.php(25): Drupal\intercept_event\SuggestedEventsProvider->getSuggestedEventIds()
#1 [internal function]: Drupal\intercept_event\Controller\EventsController->list()
#2 /var/www/drupal8/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array)
#3 /var/www/drupal8/web/core/lib/Drupal/Core/Render/Renderer.php(573): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#4 /var/www/drupal8/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#5 /var/www/drupal8/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array)
#6 /var/www/drupal8/vendor/symfony/http-kernel/HttpKernel.php(151): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#7 /var/www/drupal8/vendor/symfony/http-kernel/HttpKernel.php(68): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#8 /var/www/drupal8/web/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#9 /var/www/drupal8/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#10 /var/www/drupal8/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#11 /var/www/drupal8/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#12 /var/www/drupal8/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#13 /var/www/drupal8/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(52): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#14 /var/www/drupal8/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#15 /var/www/drupal8/web/core/lib/Drupal/Core/DrupalKernel.php(708): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#16 /var/www/drupal8/web/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#17 {main}
----

I have found that commenting out lines 123-125 of web/modules/contrib/intercept/modules/intercept_event/src/SuggestedEventsProvider.php allows things to load normally. Those lines are the 'if' statement referring to the preferred audiences, which does not seem to be a selection available in the profile for customers.

I do not have the Polaris module installed.

I'm using:
Drupal 8.9.1

PHP 7.2.24

Apache 2.4.29

Steps to reproduce

1.) Install and configure Intercept as detailed in the install notes but do not install the Polaris module.
2.) Create a new user with the role 'Intercept Registered Customer'.
3.) Log in and click on the Events or Home options from the menu (or click on the Intercept Logo).

πŸ› Bug report
Status

Fixed

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024