Error Warning: Undefined array key "uri"

Created on 19 February 2024, 4 months ago
Updated 27 April 2024, about 2 months ago

Problem/Motivation

I publish notes without any problem, then this error begin to show:

Warning: Undefined array key "uri" in Drupal\activitypub\Services\Type\TypePluginBase->getValue() (lne 240 de /var/www/domain.com/subdirectory/web/modules/contrib/activitypub/src/Services/Type/TypePluginBase.php)

appear when I run the cron.

๐Ÿ’ฌ Support request
Status

Fixed

Version

1.0

Component

Code

Created by

๐Ÿ‡ฒ๐Ÿ‡ฝMexico koffer

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

Merge Requests

Comments & Activities

  • Issue created by @koffer
  • Assigned to chetan 11
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia chetan 11
  • Merge request !28fixed โ†’ (Closed) created by chetan 11
  • Issue was unassigned.
  • Status changed to Needs review 4 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia chetan 11

    Please check the above MR.

  • Pipeline finished with Failed
    4 months ago
    Total: 490s
    #99091
  • ๐Ÿ‡ง๐Ÿ‡ชBelgium swentel

    @koffer sorry for de delay, do you happen to know on which piece of content this is? and what the values are/should be?

  • ๐Ÿ‡ฒ๐Ÿ‡ฝMexico koffer

    Im trying to send a note based in a page content type (the page used by drupal) I will paste all the error message:

    Warning: Undefined array key "uri" en Drupal\activitypub\Services\Type\TypePluginBase->getValue() (lรญne 240 in /var/www/domain.com/web/modules/contrib/activitypub/src/Services/Type/TypePluginBase.php)
    #0 /var/www/domain.com/web/core/includes/bootstrap.inc(164): _drupal_error_handler_real()
    #1 /var/www/domain.com/web/modules/contrib/activitypub/src/Services/Type/TypePluginBase.php(240): _drupal_error_handler()
    #2 /var/www/domain.com/web/modules/contrib/activitypub/src/Plugin/activitypub/type/DynamicTypes.php(153): Drupal\activitypub\Services\Type\TypePluginBase->getValue()
    #3 /var/www/domain.com/web/modules/contrib/activitypub/src/Entity/ActivityPubActivity.php(357): Drupal\activitypub\Plugin\activitypub\type\DynamicTypes->build()
    #4 /var/www/domain.com/web/modules/contrib/activitypub/src/Services/ActivityPubProcessClient.php(121): Drupal\activitypub\Entity\ActivityPubActivity->buildActivity()
    #5 /var/www/domain.com/web/modules/contrib/activitypub/activitypub.module(71): Drupal\activitypub\Services\ActivityPubProcessClient->prepareOutboxQueue()
    #6 /var/www/domain.com/web/core/lib/Drupal/Core/Cron.php(335): activitypub_cron()
    #7 /var/www/domain.com/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(388): Drupal\Core\Cron->Drupal\Core\{closure}()
    #8 /var/www/domain.com/web/core/lib/Drupal/Core/Cron.php(343): Drupal\Core\Extension\ModuleHandler->invokeAllWith()
    #9 /var/www/domain.com/web/core/lib/Drupal/Core/Cron.php(159): Drupal\Core\Cron->invokeCronHandlers()
    #10 /var/www/domain.com/web/core/lib/Drupal/Core/ProxyClass/Cron.php(75): Drupal\Core\Cron->run()
    #11 /var/www/domain.com/web/core/modules/system/src/Form/CronForm.php(167): Drupal\Core\ProxyClass\Cron->run()
    #12 [internal function]: Drupal\system\Form\CronForm->runCron()
    #13 /var/www/domain.com/web/core/lib/Drupal/Core/Form/FormSubmitter.php(129): call_user_func_array()
    #14 /var/www/domain.com/web/core/lib/Drupal/Core/Form/FormSubmitter.php(67): Drupal\Core\Form\FormSubmitter->executeSubmitHandlers()
    #15 /var/www/domain.com/web/core/lib/Drupal/Core/Form/FormBuilder.php(597): Drupal\Core\Form\FormSubmitter->doSubmitForm()
    #16 /var/www/domain.com/web/core/lib/Drupal/Core/Form/FormBuilder.php(325): Drupal\Core\Form\FormBuilder->processForm()
    #17 /var/www/domain.com/web/core/lib/Drupal/Core/Controller/FormController.php(73): Drupal\Core\Form\FormBuilder->buildForm()
    #18 [internal function]: Drupal\Core\Controller\FormController->getContentResult()
    #19 /var/www/domain.com/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array()
    #20 /var/www/domain.com/web/core/lib/Drupal/Core/Render/Renderer.php(627): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
    #21 /var/www/domain.com/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext()
    #22 /var/www/domain.com/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext()
    #23 /var/www/domain.com/vendor/symfony/http-kernel/HttpKernel.php(181): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
    #24 /var/www/domain.com/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw()
    #25 /var/www/domain.com/web/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle()
    #26 /var/www/domain.com/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle()
    #27 /var/www/domain.com/web/core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle()
    #28 /var/www/domain.com/web/core/modules/big_pipe/src/StackMiddleware/ContentLength.php(32): Drupal\Core\StackMiddleware\ContentLength->handle()
    #29 /var/www/domain.com/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\big_pipe\StackMiddleware\ContentLength->handle()
    #30 /var/www/domain.com/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass()
    #31 /var/www/domain.com/web/modules/contrib/activitypub/src/StackMiddleware/FormatSetter.php(44): Drupal\page_cache\StackMiddleware\PageCache->handle()
    #32 /var/www/domain.com/web/core/modules/ban/src/BanMiddleware.php(50): Drupal\activitypub\StackMiddleware\FormatSetter->handle()
    #33 /var/www/domain.com/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\ban\BanMiddleware->handle()
    #34 /var/www/domain.com/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
    #35 /var/www/domain.com/web/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(36): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
    #36 /var/www/domain.com/web/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\AjaxPageState->handle()
    #37 /var/www/domain.com/web/core/lib/Drupal/Core/DrupalKernel.php(704): Drupal\Core\StackMiddleware\StackedHttpKernel->handle()
    #38 /var/www/domain.com/web/index.php(19): Drupal\Core\DrupalKernel->handle()
    #39 {main}

  • ๐Ÿ‡ง๐Ÿ‡ชBelgium swentel

    ok cool, could you also show me a screenshot of the 'note' type (probably at /admin/config/services/activitypub/activitypub-type/note ?)

  • ๐Ÿ‡ฒ๐Ÿ‡ฝMexico koffer

    This is the screenshot.

  • ๐Ÿ‡ง๐Ÿ‡ชBelgium swentel

    Ooh, I see! You've configured Reply link to use the 'path' value, which isn't a 'link' field.

    I guess there's confusion here, which is totally the fault of my UI :)

    The context here of 'Reply link', is a URL to which your current node/content is replying to.
    I'm guessing you configured thinking that this should contain the url of the current node, which it shouldn't.

    So, quick fix to get rid of the notice: don't set a value for this one, unless you actually have a field on your content type which contains the absolute url of a post (either on your own site, or external).

    However: let's make sure this is a bit clearer, I see 2 things

    • document the properties of AP and what they should/can contain and why they are used. Most properties are obvious, but this clearly is confusing
    • check if the field uses 'uri' or 'value' - I was assuming this would always be 'link' field, but this can also just be a textfield which stores a link
  • ๐Ÿ‡ง๐Ÿ‡ชBelgium swentel

    Updated patch. Also checks if the field has a 'value' property because this doesn't necessarily has to a 'link' field.

    • swentel โ†’ committed 862b0455 on 1.0.x
      Issue #3422516 by chetan 11, swentel, koffer: Error Warning: Undefined...
  • Status changed to Fixed 2 months ago
  • ๐Ÿ‡ง๐Ÿ‡ชBelgium swentel

    committed and pushed, will tag a new release in a couple of minutes, thanks all!

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

Production build 0.69.0 2024