Using webform handler without an API key gives LoggerChannel error

Created on 18 April 2025, 12 days ago

Problem/Motivation

Setting up the webform handler without entering a key results in an error, because the Active Camping API cannot connect and thus returns null. The logger then tries to print this as a message, but since it cannot handle null values, the site crashed.

The website encountered an unexpected error. Try again later.

TypeError: Drupal\Core\Logger\LoggerChannel::error(): Argument #1 ($message) must be of type Stringable|string, null given, called in /var/www/html/web/modules/contrib/activecampaign/modules/activecampaign_webform/src/Plugin/WebformHandler/ActiveCampaignFormHandler.php on line 203 in Drupal\Core\Logger\LoggerChannel->error() (line 48 of /var/www/html/vendor/psr/log/src/LoggerTrait.php).
Drupal\activecampaign_webform\Plugin\WebformHandler\ActiveCampaignFormHandler->submitForm() (Line: 2758)
Drupal\webform\Entity\Webform->invokeHandlers() (Line: 1924)
Drupal\webform\WebformSubmissionForm->submitForm()
call_user_func_array() (Line: 105)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers() (Line: 43)
Drupal\Core\Form\FormSubmitter->doSubmitForm() (Line: 589)
Drupal\Core\Form\FormBuilder->processForm() (Line: 321)
Drupal\Core\Form\FormBuilder->buildForm() (Line: 48)
Drupal\Core\Entity\EntityFormBuilder->getForm() (Line: 1250)
Drupal\webform\Entity\Webform->getSubmissionForm() (Line: 128)
Drupal\webform\Controller\WebformTestController->testForm()
call_user_func_array() (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 593)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 121)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 183)
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: 709)
Drupal\Core\DrupalKernel->handle() (Line: 19)

Steps to reproduce

Install and enable the activecampaign and activecampaign_webform modules, without filling in the settings. Add an activecampaign webformhandler on a form and fill it in. When sending the data, you get the above error.

Proposed resolution

Check if there is connection to Active campaigning and if not log a notification in the watchdog that they need to add this before continuing, to prevent the site from crashing and so that the webform can still be submitted.

Remaining tasks

Add the code, make an MR and merge after testing.

User interface changes

/

API changes

/

Data model changes

/

🐛 Bug report
Status

Active

Version

2.0

Component

Code

Created by

🇧🇪Belgium dtfabio Ninove

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

Comments & Activities

Production build 0.71.5 2024