when use composer update jsonapi_extras to 2.11.0

Updating drupal/jsonapi_extras (2.10.0 => 2.11.0): Downloading (100%)

have some error:

http://mysite.com/admin/config/services/jsonapi

Error:Call to a member function id() on null in Drupal\jsonapi_extras\JsonapiResourceConfigListBuilder->render()(file /usr/share/nginx/dc/web/modules/contrib/jsonapi_extras/src/JsonapiResourceConfigListBuilder.php line 195

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

xiukun.zhou created an issue. See original summary.

e0ipso’s picture

Can you share your configuration? I don't think to be able to reproduce this with a clean install.

kil’s picture

Having the same problem on my side. Using jsonapi 8.x-1.23 and current Drupal 8.6.3 (PHP 7.2.10)

Can't use jsonapi 2.x because there I get the error:
ArgumentCountError: Too few arguments to function Drupal\jsonapi\Normalizer\EntityNormalizer::__construct(), 3 passed in /var/www/html/modules/contrib/consumer_image_styles/src/Normalizer/ImageEntityNormalizer.php on line 80 and exactly 5 expected in Drupal\jsonapi\Normalizer\EntityNormalizer->__construct() (line 89 of /var/www/html/modules/contrib/jsonapi/src/Normalizer/EntityNormalizer.php)
Seems to be related to #2958554: Allow creation of file entities from binary data via JSON API requests, maybe something relevant here?
Going back to jsonapi_extras 2.10 solves the problem.

ashutoshsngh’s picture

Facing same issue on this route admin/config/services/jsonapi

2018/11/15 04:25:30 [error] 8#8: *735 FastCGI sent in stderr: "PHP message: Error: Call to a member function id() on null in /var/www/drupal8-demo/web/modules/contrib/jsonapi_extras/src/JsonapiResourceConfigListBuilder.php on line 195 #0 /var/www/drupal8-demo/web/core/lib/Drupal/Core/Entity/Controller/EntityListController.php(23): Drupal\jsonapi_extras\JsonapiResourceConfigListBuilder->render()
#1 [internal function]: Drupal\Core\Entity\Controller\EntityListController->listing('jsonapi_resourc...')
#2 /var/www/drupal8-demo/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array)
#3 /var/www/drupal8-demo/web/core/lib/Drupal/Core/Render/Renderer.php(582): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#4 /var/www/drupal8-demo/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#5 /var/ww" while reading response header from upstream, client: 10.5.0.1, server: demo.drupal.local, request: "GET /admin/config/services/jsonapi HTTP/1.1", upstream: "fastcgi://10.5.0.4:9000", host: "demo.drupal.local"
labboy0276’s picture

Using latest version on contenta which uses json_api_extras 2.11 results in this fun error on node view in the backend:

Error: Class '\Drupal\jsonapi\JsonApiResource\JsonApiDocumentTopLevel' not found in Drupal\jsonapi_extras\EntityToJsonApi->normalize() (line 130 of /app/web/modules/contrib/jsonapi_extras/src/EntityToJsonApi.php) #0 /app/web/profiles/contrib/contenta_jsonapi/modules/contenta_enhancements/contenta_enhancements.module(376): Drupal\jsonapi_extras\EntityToJsonApi->normalize(Object(Drupal\node\Entity\Node)) #1 /app/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(539): contenta_enhancements_node_view_alter(Array, Object(Drupal\node\Entity\Node), Object(Drupal\Core\Entity\Entity\EntityViewDisplay)) #2 /app/web/core/lib/Drupal/Core/Entity/EntityViewBuilder.php(286): Drupal\Core\Extension\ModuleHandler->alter('node_view', Array, Object(Drupal\node\Entity\Node), Object(Drupal\Core\Entity\Entity\EntityViewDisplay)) #3 /app/web/core/lib/Drupal/Core/Entity/EntityViewBuilder.php(220): Drupal\Core\Entity\EntityViewBuilder->buildMultiple(Array) #4 [internal function]: Drupal\Core\Entity\EntityViewBuilder->build(Array) #5 /app/web/core/lib/Drupal/Core/Render/Renderer.php(378): call_user_func(Array, Array) #6 /app/web/core/lib/Drupal/Core/Render/Renderer.php(195): Drupal\Core\Render\Renderer->doRender(Array, false) #7 /app/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(226): Drupal\Core\Render\Renderer->render(Array, false) #8 /app/web/core/lib/Drupal/Core/Render/Renderer.php(582): Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() #9 /app/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(227): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure)) #10 /app/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(117): Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\CurrentRouteMatch)) #11 /app/web/core/lib/Drupal/Core/EventSubscriber/MainContentViewSubscriber.php(90): Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\CurrentRouteMatch)) #12 [internal function]: Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object(Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent), 'kernel.view', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher)) #13 /app/web/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(111): call_user_func(Array, Object(Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent), 'kernel.view', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher)) #14 /app/vendor/symfony/http-kernel/HttpKernel.php(156): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('kernel.view', Object(Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent)) #15 /app/vendor/symfony/http-kernel/HttpKernel.php(68): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1) #16 /app/web/modules/contrib/simple_oauth/src/HttpMiddleware/BasicAuthSwap.php(67): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #17 /app/web/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Drupal\simple_oauth\HttpMiddleware\BasicAuthSwap->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #18 /app/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #19 /app/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(99): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #20 /app/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(78): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true) #21 /app/web/modules/contrib/jsonapi/src/StackMiddleware/FormatSetter.php(51): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #22 /app/vendor/asm89/stack-cors/src/Asm89/Stack/Cors.php(49): Drupal\jsonapi\StackMiddleware\FormatSetter->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #23 /app/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Asm89\Stack\Cors->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #24 /app/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(52): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #25 /app/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #26 /app/web/core/lib/Drupal/Core/DrupalKernel.php(669): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #27 /app/web/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request)) #28 {main}.

Rolling json_api_extras to 2.10 fixes the issue.

jebschiefer’s picture

I'm also running into issues with jsonapi_extras 2.11.0 + jsonapi 1.23.0.

When make a request that filters by a uuid, I get the following stacktrace:

Error: Call to a member function id() on null in Drupal\jsonapi_extras\ResourceType\ConfigurableResourceType->getResourceFieldConfiguration() (line 152 of /var/www/html/web/modules/contrib/jsonapi_extras/src/ResourceType/ConfigurableResourceType.php) #0 /var/www/html/web/modules/contrib/jsonapi_extras/src/ResourceType/ConfigurableResourceType.php(269): Drupal\jsonapi_extras\ResourceType\ConfigurableResourceType->getResourceFieldConfiguration('field_site_prop...', 'publicName') #1 /var/www/html/web/modules/contrib/jsonapi_extras/src/ResourceType/ConfigurableResourceType.php(64): Drupal\jsonapi_extras\ResourceType\ConfigurableResourceType->translateFieldName('field_site_prop...', 'publicName', 'fieldName') #2 /var/www/html/web/modules/contrib/jsonapi/src/Context/FieldResolver.php(395): Drupal\jsonapi_extras\ResourceType\ConfigurableResourceType->getInternalName('field_site_prop...') #3 [internal function]: Drupal\jsonapi\Context\FieldResolver->Drupal\jsonapi\Context\{closure}('field_site_prop...', Object(Drupal\jsonapi_extras\ResourceType\ConfigurableResourceType)) #4 /var/www/html/web/modules/contrib/jsonapi/src/Context/FieldResolver.php(396): array_reduce(Array, Object(Closure), 'field_site_prop...') #5 /var/www/html/web/modules/contrib/jsonapi/src/Context/FieldResolver.php(254): Drupal\jsonapi\Context\FieldResolver->getInternalName('field_site_prop...', Array) #6 /var/www/html/web/modules/contrib/jsonapi/src/Normalizer/FilterNormalizer.php(191): Drupal\jsonapi\Context\FieldResolver->resolveInternalEntityQueryPath('node', 'program_top_lev...', 'field_site_prop...') #7 /var/www/html/web/modules/contrib/jsonapi/src/Normalizer/FilterNormalizer.php(146): Drupal\jsonapi\Normalizer\FilterNormalizer->expandItem('field_site_prop...', Array, Array) #8 /var/www/html/web/modules/contrib/jsonapi/src/Normalizer/FilterNormalizer.php(96): Drupal\jsonapi\Normalizer\FilterNormalizer->expand(Array, Array) #9 /var/www/html/web/modules/contrib/jsonapi/src/Routing/JsonApiParamEnhancer.php(71): Drupal\jsonapi\Normalizer\FilterNormalizer->denormalize(Array, 'Drupal\\jsonapi\\...', NULL, Array) #10 /var/www/html/web/core/lib/Drupal/Core/Routing/Router.php(259): Drupal\jsonapi\Routing\JsonApiParamEnhancer->enhance(Array, Object(Symfony\Component\HttpFoundation\Request)) #11 /var/www/html/web/core/lib/Drupal/Core/Routing/Router.php(130): Drupal\Core\Routing\Router->applyRouteEnhancers(Array, Object(Symfony\Component\HttpFoundation\Request)) #12 /var/www/html/web/core/lib/Drupal/Core/Routing/AccessAwareRouter.php(90): Drupal\Core\Routing\Router->matchRequest(Object(Symfony\Component\HttpFoundation\Request)) #13 /var/www/html/vendor/symfony/http-kernel/EventListener/RouterListener.php(115): Drupal\Core\Routing\AccessAwareRouter->matchRequest(Object(Symfony\Component\HttpFoundation\Request)) #14 [internal function]: Symfony\Component\HttpKernel\EventListener\RouterListener->onKernelRequest(Object(Symfony\Component\HttpKernel\Event\GetResponseEvent), 'kernel.request', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher)) #15 /var/www/html/web/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(111): call_user_func(Array, Object(Symfony\Component\HttpKernel\Event\GetResponseEvent), 'kernel.request', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher)) #16 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(127): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('kernel.request', Object(Symfony\Component\HttpKernel\Event\GetResponseEvent)) #17 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(68): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1) #18 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #19 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #20 /var/www/html/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(184): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #21 /var/www/html/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(121): Drupal\page_cache\StackMiddleware\PageCache->fetch(Object(Symfony\Component\HttpFoundation\Request), 1, true) #22 /var/www/html/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(75): Drupal\page_cache\StackMiddleware\PageCache->lookup(Object(Symfony\Component\HttpFoundation\Request), 1, true) #23 /var/www/html/web/modules/contrib/jsonapi/src/StackMiddleware/FormatSetter.php(51): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #24 /var/www/html/vendor/asm89/stack-cors/src/Asm89/Stack/Cors.php(49): Drupal\jsonapi\StackMiddleware\FormatSetter->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #25 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Asm89\Stack\Cors->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #26 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(52): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #27 /var/www/html/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #28 /var/www/html/web/core/lib/Drupal/Core/DrupalKernel.php(669): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #29 /var/www/html/web/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request)) #30 {main}.

If I modify the request so that it has no query parameters (just a plain GET /jsonapi/node/<content_type>), I get this stacktrace:

Error: Call to a member function get() on null in Drupal\jsonapi_extras\ResourceType\ConfigurableResourceType->includeCount() (line 118 of /var/www/html/web/modules/contrib/jsonapi_extras/src/ResourceType/ConfigurableResourceType.php) #0 /var/www/html/web/modules/contrib/jsonapi/src/Controller/EntityResource.php(381): Drupal\jsonapi_extras\ResourceType\ConfigurableResourceType->includeCount() #1 [internal function]: Drupal\jsonapi\Controller\EntityResource->getCollection(Object(Symfony\Component\HttpFoundation\Request)) #2 /var/www/html/web/modules/contrib/jsonapi/src/Controller/RequestHandler.php(126): call_user_func_array(Array, Array) #3 [internal function]: Drupal\jsonapi\Controller\RequestHandler->handle(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\jsonapi_extras\ResourceType\ConfigurableResourceType)) #4 /var/www/html/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array) #5 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(582): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() #6 /var/www/html/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure)) #7 /var/www/html/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) #8 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(151): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() #9 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(68): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1) #10 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #11 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #12 /var/www/html/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(184): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #13 /var/www/html/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(121): Drupal\page_cache\StackMiddleware\PageCache->fetch(Object(Symfony\Component\HttpFoundation\Request), 1, true) #14 /var/www/html/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(75): Drupal\page_cache\StackMiddleware\PageCache->lookup(Object(Symfony\Component\HttpFoundation\Request), 1, true) #15 /var/www/html/web/modules/contrib/jsonapi/src/StackMiddleware/FormatSetter.php(51): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #16 /var/www/html/vendor/asm89/stack-cors/src/Asm89/Stack/Cors.php(49): Drupal\jsonapi\StackMiddleware\FormatSetter->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #17 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Asm89\Stack\Cors->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #18 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(52): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #19 /var/www/html/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #20 /var/www/html/web/core/lib/Drupal/Core/DrupalKernel.php(669): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #21 /var/www/html/web/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request)) #22 {main}.

Rolling back to jsonapi_extras 2.10.0 works for me as others have noted.

superbiche’s picture

I confirm I can reproduce the issue with 2.11 and that rolling back to 2.10 fixes it

benjifisher’s picture

There may be more than one problem discussed here. I am seeing the error described in the second scenario described in #6.

Steps to reproduce

  1. Install Drupal 8.7.x with the Umami installation profile.
  2. Install drush and this module, with dependencies: composer require drush/drush drupal/jsonapi_extras.
  3. Enable this module and dependencies: drush -y en jsonapi_extras.
  4. Give anonymous users the "Access JSON API resource list" permission.
  5. Request a list of taxonomy terms or nodes: wget http://my_site.com/jsonapi/taxonomy_term/tags or wget http://my_site.com/jsonapi/node/article.

Results

With 8.x-2.10: this works as expected.

With 8.x-2.11: I get the following response when I try the wget command:

HTTP request sent, awaiting response... 500 Internal Server Error

Checking the Drupal log (drush ws) I see the same error (node or term gives the same result):

Error: Call to a member function get() on null in Drupal\jsonapi_extras\ResourceType\ConfigurableResourceType->includeCount()
(line 118 of /app/modules/contrib/jsonapi_extras/src/ResourceType/ConfigurableResourceType.php)
#0               /app/modules/contrib/jsonapi/src/Controller/EntityResource.php(381):

Code

Looking at the indicated lines, I see this:

  public function includeCount() {
    return $this->configFactory
      ->get('jsonapi_extras.settings')
      ->get('include_count');
  }

Without digging into the code too much, I would expect $this->configFactory to be initialized in the class constructor. Instead, I see there is a setConfigFactory() method. As the abbreviated stack trace shows, this is being called from the controller in the jsonapi module, which does not know to call the setter method. But this part of the code does not seem to have changed since 8.x-2.10, so I am confused.

Just a guess: after #3007091: Performance issue in ConfigurableResourceType, the code path that sets $this->configFactory is not executed.

TwoD’s picture

Priority: Normal » Critical

I think this was also caused by #3010239: Fatal error: require(): 'jsonapi/src/Field/FileDownloadUrl.php' in vendor/symfony/class-loader/ApcClassLoader.php on line 112.

Edit: I just found out we somehow still had JSONAPI 1.x installed. Properly upgrading to it 2.x fixed the issue.

benjifisher’s picture

@TwoD:

This module (8.x-2.11 version) specifies "drupal/jsonapi": "^1.22" in its composer.json, so it is hard to switch to the 2.x branch of jsonapi if you install with composer.

I see that the 3.x branch of this module recently required "drupal/jsonapi": "^1.22 || ^2.0-rc1" and now requires "drupal/jsonapi": "^2.0-rc1". Maybe the right way to solve this issue is to make a release on the 3.x branch.

e0ipso’s picture

Title: Update to 2.11 no work » Update to 2.11 is broken
e0ipso’s picture

#3016725: Do not use cache.static just landed, can you test if 8.x-2.12 fixes the problems here?

eojthebrave’s picture

I'm seeing the same issue as reported in #6 and #8 while using JSON API 1.23.0, and JSON API Extras 2.13.0.

gun_dose’s picture

The same problem as #6 and #8 with JSON API 1.23.0, and JSON API Extras 2.13.0. Downgrading to JSON API Extras 2.10.0 solved this.

marc.groth’s picture

Same issue here with the latest version of this module (2.14). Downgrading to 2.10 fixes it. That's with jsonapi version 1.23.

el1_1el’s picture

Updating from 2.10 to 2.14 and hitting /jsonapi/node/[content_type] gives
Error: Call to a member function get() on null in Drupal\jsonapi_extras\ResourceType\ConfigurableResourceType->includeCount() just like above. Downgrading fixes

benjifisher’s picture

According to Comment #9, versions 8.x-2.11+ of this module work with the 8.x-2.x branch of the JSON API module. So maybe all we have to do to fix this issue is update composer.json.

kil’s picture

With the security update of JSON:API I had the chance to try out, which combinations of JSON:API and JSON:API Extras do work at my installation (Drupal 8.6.4 and PHP 7.2.10):

  • JSON:API 8.x-1.24 + JSON:API Extras 8.x.2.10: does work as expected
  • JSON:API 8.x-1.24 + JSON:API Extras 8.x.2.14: get's me an error: "Call to a member function get() on null in Drupal\jsonapi_extras\ResourceType\ConfigurableResourceType->includeCount() [...]", same as #16
  • JSON:API 8.x-1.24 + JSON:API Extras 8.x.3.0: get's me some warnings and an error: "Error: Call to undefined method Drupal\jsonapi\ResourceType\ResourceType::getFieldEnhancer() in Drupal\jsonapi_extras\Normalizer\FieldItemNormalizer->normalize() [...]"

I then tried it with JSON:API 8.x-2.0-rc4, but there I run into the problem described here: #3020237: [Regression] Broken with latest jsonapi 2.0-rc3

With regard to the security update, currently the only working constellation for me is: JSON:API 8.x-1.24 + JSON:API Extas 8.x.2.10

e0ipso’s picture

Version: 8.x-1.x-dev » 8.x-2.x-dev
Status: Active » Needs review
FileSize
9.65 KB

Let's see if this works

e0ipso’s picture

Can anyone test the patch above?

benjifisher’s picture

Status: Needs review » Needs work

I tried the same steps to reproduce that I described in #8, and I got the same result. The only difference is that the line numbers have changed.

Drupal 8.7.x
JSON API 8.x-1.24
JSON API Extras 8.x-2.14 with the patch from #19.

e0ipso’s picture

Status: Needs work » Needs review
FileSize
14.58 KB

This should make tests green for JSON:API 1.x.

e0ipso’s picture

This should keep tests green.

benjifisher’s picture

Status: Needs review » Needs work

Did you set the status to NR in order to trigger the testbot or did you want a manual re-test? I get the same results with #23 as I did with the patch from #19.

  • e0ipso authored f1e6fe2 on 8.x-2.x
    Issue #3013544 by e0ipso, benjifisher, kil, xiukun.zhou, superbiche,...
e0ipso’s picture

Status: Needs work » Fixed

@benjifisher I was not able to reproduce locally with the latest stable release of Drupal core. Can you try with that? It would really help to isolate the problem to D8.7.x.

e0ipso’s picture

According to https://www.drupal.org/pift-ci-job/1156409 tests pass with the current version using D8.7

e0ipso’s picture

This was released in 2.15

benjifisher’s picture

@e0ipso:

I guess there was something broken on my site. I re-tested with

  • Drupal 8.6.4 and 8.7.x
  • JSON API 8.x-1.24
  • JSON API Extras 8.x-2.15

and did not get any errors.

I see that there is one other commit since 8.x-2.14. I may re-test after backing out that commit. If I do, and the error returns, then I will post again on this issue. But I am more interested in trying out the recently released 8.x-3.1 with JSON API 8.x-2.x.

e0ipso’s picture

That's good news @benjifisher. Thanks for the feedback.

Status: Fixed » Closed (fixed)

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

kil’s picture

Sorry for the late feedback, can confirm #29 that Drupal 8.6.5 + JSON:API 8.x-1.24 and JSONA:API Extras 8.x-2.15 works. Thanks for fixing the issue! (in my case I needed to call an explicit drush cr, but afterwards it worked)

I also tried out Drupal 8.6.5 + JSON:API 8.x-2.0 and JSON:API Extras 8.x-3.2, which also worked fine, expect for installations that use Consumer Image Styles (due to #3007268: Make Consumer Image Styles compatible with JSON API 2.0-beta2)