Entity share PULL Entities issue

Created on 14 February 2025, 2 months ago

Problem/Motivation

The current website has been configured using Drupal version 10.2.4, with PHP updated to version 8.3.15.

I have a Vocabulary Terms setup that contains various fields, including term references and paragraph references linked to the Terms field. The entity share pull was successful on previous PHP version was 8.1.16, which has now been upgraded to PHP 8.3.15.

The entity share pull request is displayed as follows.

TypeError: Drupal\jsonapi\Normalizer\JsonApiDocumentTopLevelNormalizer::validateRequestBody(): Argument #2 ($resource_type) must be of type Drupal\jsonapi\ResourceType\ResourceType, null given, called in /opt/drupal/web/core/modules/jsonapi/src/Normalizer/JsonApiDocumentTopLevelNormalizer.php on line 72 in Drupal\jsonapi\Normalizer\JsonApiDocumentTopLevelNormalizer::validateRequestBody() (line 291 of /opt/drupal/web/core/modules/jsonapi/src/Normalizer/JsonApiDocumentTopLevelNormalizer.php).

Steps to reproduce

Entity share PULL by PULL ENTITIES menu

🐛 Bug report
Status

Active

Version

3.0

Component

Entity Share Client

Created by

🇮🇳India prakash3108

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

Comments & Activities

  • Issue created by @prakash3108
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
  • Issue was unassigned.
  • 🇬🇧United Kingdom dahousecat

    $context['resource_type'] is set in entity_share/modules/entity_share_client/src/Service/JsonapiHelper.php from the return value of ResourceTypeRepository->getByTypeName()

    This will return null if a resource type is not found with that name.

    Just showing the user which name returned null, and possibly a list of valid names, would go a long way to helping debug what the underlying issue is.

    E.g.

    if (!$resourceType instanceof ResourceType) {
      $allTypes = $this->resourceTypeRepository->all();
      $args = [$data['type'], implode(', ', array_keys($allTypes))];
      throw new \InvalidArgumentException(vsprintf('ResourceType with name %s not found. Valid names are: %s', $args));
    }
    

    After I added this code when when syncing entities that fail I now get an error like:

    ResourceType with name node--region not found. Valid names are: batch_plugin_entity--batch_plugin_entity, block--block...
    
Production build 0.71.5 2024