Settings form requires different fields

Created on 22 June 2023, about 1 year ago
Updated 21 October 2023, 8 months ago

Problem/Motivation

Using the plugin throws error TypeError: JoliCode\Slack\ClientFactory::create(): Argument #1 ($token) must be of type string, null given, called in XXX/web/modules/contrib/pf_slack/src/Plugin/PushFrameworkChannel/Slack.php on line 44

💬 Support request
Status

Active

Version

2.3

Component

Code

Created by

🇩🇪Germany thomas.wardin

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

Comments & Activities

  • Issue created by @thomas.wardin
    • jurgenhaas committed 00e13baa on 2.1.x
      Issue #3368685 by thomas.wardin, jurgenhaas: Settings form requires...
  • 🇩🇪Germany jurgenhaas Gottmadingen

    This looks like you haven't configured your Slack channel yet. Please go to /admin/config/system/push_framework/slack and provide the credentials there, so that the Slack library can use them to send messages on your behalf.

  • 🇩🇪Germany thomas.wardin

    You are right. Obviously got distracted by creating the ECA model and forgot the backend.

    Entered the token xoxb-VALUE but still not working. I even reinstalled the app/bot to my workspace.

    Error details:

    Failed execution of Nachricht an Slack (#allgemeines) (Activity_087i5gl) from ECA Neuer/aktualisierter Inhalt (process_jtcehec) for event Drupal\eca_content\Event\ContentEntityUpdate: No PSR-18 clients found. Make sure to install a package providing "psr/http-client-implementation". Example: "php-http/guzzle7-adapter"..
    #0 SITEROOT/vendor/jolicode/slack-php-api/src/ClientFactory.php(31): Http\Discovery\Psr18ClientDiscovery::find() #1 SITEROOT/web/modules/contrib/pf_slack/src/Plugin/PushFrameworkChannel/Slack.php(44): JoliCode\Slack\ClientFactory::create('xoxb-6897326535...')
    #2 SITEROOT/web/modules/contrib/push_framework/src/Plugin/Action/Notify.php(101): Drupal\pf_slack\Plugin\PushFrameworkChannel\Slack->send(Object(Drupal\user\Entity\User), Object(Drupal\node\Entity\Node), Array, 0)
    #3 SITEROOT/web/modules/contrib/eca/src/Entity/Objects/EcaAction.php(102): Drupal\push_framework\Plugin\Action\Notify->execute(NULL)
    #4 SITEROOT/web/modules/contrib/eca/src/Processor.php(188): Drupal\eca\Entity\Objects\EcaAction->execute(Object(Drupal\eca\Entity\Objects\EcaEvent), Object(Drupal\eca_content\Event\ContentEntityUpdate), Array)
    #5 SITEROOT/web/modules/contrib/eca/src/Processor.php(146): Drupal\eca\Processor->executeSuccessors(Object(Drupal\eca\Entity\Eca), Object(Drupal\eca\Entity\Objects\EcaEvent), Object(Drupal\eca_content\Event\ContentEntityUpdate), Array)
    #6 SITEROOT/web/modules/contrib/eca/src/EventSubscriber/EcaBase.php(76): Drupal\eca\Processor->execute(Object(Drupal\eca_content\Event\ContentEntityUpdate), 'eca.content_ent...')
    #7 [internal function]: Drupal\eca\EventSubscriber\EcaBase->onEvent(Object(Drupal\eca_content\Event\ContentEntityUpdate), 'eca.content_ent...', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher))
    #8 SITEROOT/web/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(142): call_user_func(Array, Object(Drupal\eca_content\Event\ContentEntityUpdate), 'eca.content_ent...', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher))
    #9 SITEROOT/web/modules/contrib/eca/src/Event/TriggerEvent.php(73): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object(Drupal\eca_content\Event\ContentEntityUpdate), 'eca.content_ent...')
    #10 SITEROOT/web/modules/contrib/eca/modules/content/src/HookHandler.php(297): Drupal\eca\Event\TriggerEvent->dispatchFromPlugin('content_entity:...', Object(Drupal\node\Entity\Node), Object(Drupal\eca\Service\ContentEntityTypes))
    #11 SITEROOT/web/modules/contrib/eca/modules/content/eca_content.module(97): Drupal\eca_content\HookHandler->update(Object(Drupal\node\Entity\Node))
    #12 [internal function]: eca_content_entity_update(Object(Drupal\node\Entity\Node))
    #13 SITEROOT/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(426): call_user_func_array(Object(Closure), Array)
    #14 SITEROOT/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(405): Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}(Object(Closure), 'eca_content')
    #15 SITEROOT/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(433): Drupal\Core\Extension\ModuleHandler->invokeAllWith('entity_update', Object(Closure))
    #16 SITEROOT/web/core/lib/Drupal/Core/Entity/EntityStorageBase.php(251): Drupal\Core\Extension\ModuleHandler->invokeAll('entity_update', Array)
    #17 SITEROOT/web/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php(900): Drupal\Core\Entity\EntityStorageBase->invokeHook('update', Object(Drupal\node\Entity\Node))
    #18 SITEROOT/web/core/lib/Drupal/Core/Entity/EntityStorageBase.php(598): Drupal\Core\Entity\ContentEntityStorageBase->invokeHook('update', Object(Drupal\node\Entity\Node))
    #19 SITEROOT/web/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php(781): Drupal\Core\Entity\EntityStorageBase->doPostSave(Object(Drupal\node\Entity\Node), true)
    #20 SITEROOT/web/core/lib/Drupal/Core/Entity/EntityStorageBase.php(523): Drupal\Core\Entity\ContentEntityStorageBase->doPostSave(Object(Drupal\node\Entity\Node), true)
    #21 SITEROOT/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php(804): Drupal\Core\Entity\EntityStorageBase->save(Object(Drupal\node\Entity\Node))
    #22 SITEROOT/web/core/lib/Drupal/Core/Entity/EntityBase.php(339): Drupal\Core\Entity\Sql\SqlContentEntityStorage->save(Object(Drupal\node\Entity\Node))
    #23 SITEROOT/web/core/modules/node/src/NodeForm.php(270): Drupal\Core\Entity\EntityBase->save()
    #24 [internal function]: Drupal\node\NodeForm->save(Array, Object(Drupal\Core\Form\FormState))
    #25 SITEROOT/web/core/lib/Drupal/Core/Form/FormSubmitter.php(114): call_user_func_array(Array, Array)
    #26 SITEROOT/web/core/lib/Drupal/Core/Form/FormSubmitter.php(52): Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object(Drupal\Core\Form\FormState))
    #27 SITEROOT/web/core/lib/Drupal/Core/Form/FormBuilder.php(597): Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object(Drupal\Core\Form\FormState))
    #28 SITEROOT/web/modules/contrib/autosave_form/src/Form/AutosaveFormBuilder.php(144): Drupal\Core\Form\FormBuilder->processForm('node_article_ed...', Array, Object(Drupal\Core\Form\FormState))
    #29 SITEROOT/web/core/lib/Drupal/Core/Form/FormBuilder.php(325): Drupal\autosave_form\Form\AutosaveFormBuilder->processForm('node_article_ed...', Array, Object(Drupal\Core\Form\FormState))
    #30 SITEROOT/web/modules/contrib/autosave_form/src/Form/AutosaveFormBuilder.php(97): Drupal\Core\Form\FormBuilder->buildForm(Object(Drupal\node\NodeForm), Object(Drupal\Core\Form\FormState))
    #31 SITEROOT/web/core/lib/Drupal/Core/Controller/FormController.php(73): Drupal\autosave_form\Form\AutosaveFormBuilder->buildForm(Object(Drupal\node\NodeForm), Object(Drupal\Core\Form\FormState))
    #32 [internal function]: Drupal\Core\Controller\FormController->getContentResult(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\RouteMatch))
    #33 SITEROOT/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array)
    #34 SITEROOT/web/core/lib/Drupal/Core/Render/Renderer.php(580): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
    #35 SITEROOT/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
    #36 SITEROOT/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array)
    #37 SITEROOT/vendor/symfony/http-kernel/HttpKernel.php(169): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
    #38 SITEROOT/vendor/symfony/http-kernel/HttpKernel.php(81): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
    #39 SITEROOT/web/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #40 SITEROOT/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #41 SITEROOT/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #42 SITEROOT/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #43 SITEROOT/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #44 SITEROOT/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #45 SITEROOT/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #46 SITEROOT/web/core/lib/Drupal/Core/DrupalKernel.php(718): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #47 SITEROOT/web/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
    #48 {main}
  • 🇩🇪Germany thomas.wardin

    Maybe making the Token field mandatory would help avoiding such silly support requests.

  • 🇩🇪Germany thomas.wardin

    Side notice: Slack module uses incoming webhook, which works just fine. So maybe I have not completed the configuration on the Slack end correctly?

  • 🇩🇪Germany jurgenhaas Gottmadingen

    Well, the error message

    No PSR-18 clients found. Make sure to install a package providing "psr/http-client-implementation". Example: "php-http/guzzle7-adapter"
    

    comes form \Http\Discovery\Psr18ClientDiscovery::find which is a third party dependency. Why they are missing a client, I can't tell, that's probably something to report to the maintainer of the jolicode/slack-php-api package which is used to talk to Slack.

    I don't have any access to a Slack instance where I could get webhook credentials from, so I can't test that myself. But I'm happy to review and merge MRs, if you can fix that at your end.

  • 🇩🇪Germany jurgenhaas Gottmadingen

    Just checked on their readme at https://packagist.org/packages/jolicode/slack-php-api and they advise to install a PSR-18 client or PSR-7 message factory if none does exist in your project yet.

    As I'm running this in Drupal 7, I suspect that the symfony/http-client fulfils that requirement. I'm not sure if the same applies for Drupal 9 and I don't know which Drupal version you're using.

    Maybe these hints are getting you further into the debugging of this.

  • 🇩🇪Germany thomas.wardin

    For the jolicode part: Would that only be a dependency to add?

    For webhook: Seems like webhooks may be deprecated in a while, that's why there is a rewrite for version 2.0 of the Slack module (https://git.drupalcode.org/project/slack) which as far as I can see comes without any additional dependency. They even claim "You can also use our module API in your modules" in their Readme. May be worth a look.

    I am using Drupal 9.5

  • 🇩🇪Germany thomas.wardin

    Tried requiring symfony/http-client (ok).
    With a renewed bot configuration, it worked.

    You might consider adding the dependency.

  • 🇩🇪Germany danielspeicher Steisslingen
Production build 0.69.0 2024