After updating jsonapi and jsonapi_extras to then most recent versions and visiting /jsonapi/user/user - we're getting this error (long one) on Drupal 8.6.4 site along with some notices like:
Notice: Undefined index: name in Drupal\jsonapi\Normalizer\LabelOnlyEntityNormalizer->normalize() (line 86 of /vagrant/drupal/web/modules/contrib/jsonapi/src/Normalizer/LabelOnlyEntityNormalizer.php) #0 /vagrant/drupal/web/core/includes/bootstrap.inc(584): _drupal_error_handler_real(8, 'Undefined index...', '/vagrant/drupal...', 86, Array) #1 ...
Error: Call to a member function getPropertyType() on null in Drupal\jsonapi\Normalizer\Value\EntityNormalizerValue->rasterizeValue() (line 90 of /vagrant/drupal/web/modules/contrib/jsonapi/src/Normalizer/Value/EntityNormalizerValue.php) #0 /vagrant/drupal/web/modules/contrib/jsonapi/src/Normalizer/Value/JsonApiDocumentTopLevelNormalizerValue.php(199): Drupal\jsonapi\Normalizer\Value\EntityNormalizerValue->rasterizeValue() #1 /vagrant/drupal/web/modules/contrib/jsonapi/src/Encoder/JsonEncoder.php(32): Drupal\jsonapi\Normalizer\Value\JsonApiDocumentTopLevelNormalizerValue->rasterizeValue() #2 /vagrant/drupal/vendor/symfony/serializer/Encoder/ChainEncoder.php(40): Drupal\jsonapi\Encoder\JsonEncoder->encode(Object(Drupal\jsonapi\Normalizer\Value\JsonApiDocumentTopLevelNormalizerValue), 'api_json', Array) #3 /vagrant/drupal/vendor/symfony/serializer/Serializer.php(272): Symfony\Component\Serializer\Encoder\ChainEncoder->encode(Object(Drupal\jsonapi\Normalizer\Value\JsonApiDocumentTopLevelNormalizerValue), 'api_json', Array) #4 [internal function]: Symfony\Component\Serializer\Serializer->encode(Object(Drupal\jsonapi\Normalizer\Value\JsonApiDocumentTopLevelNormalizerValue), 'api_json') #5 /vagrant/drupal/web/modules/contrib/jsonapi_extras/src/SerializerDecorator.php(67): call_user_func_array(Array, Array) #6 /vagrant/drupal/web/modules/contrib/jsonapi_extras/src/SerializerDecorator.php(95): Drupal\jsonapi_extras\SerializerDecorator->relay('encode', Array) #7 /vagrant/drupal/web/modules/contrib/jsonapi/src/EventSubscriber/ResourceResponseSubscriber.php(124): Drupal\jsonapi_extras\SerializerDecorator->encode(Object(Drupal\jsonapi\Normalizer\Value\JsonApiDocumentTopLevelNormalizerValue), 'api_json') #8 /vagrant/drupal/web/modules/contrib/jsonapi/src/EventSubscriber/ResourceResponseSubscriber.php(82): Drupal\jsonapi\EventSubscriber\ResourceResponseSubscriber->renderResponseBody(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\jsonapi\ResourceResponse), Object(Drupal\jsonapi_extras\SerializerDecorator), 'api_json') #9 [internal function]: Drupal\jsonapi\EventSubscriber\ResourceResponseSubscriber->onResponse(Object(Symfony\Component\HttpKernel\Event\FilterResponseEvent), 'kernel.response', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher)) #10 /vagrant/drupal/web/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(111): call_user_func(Array, Object(Symfony\Component\HttpKernel\Event\FilterResponseEvent), 'kernel.response', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher)) #11 /vagrant/drupal/vendor/symfony/http-kernel/HttpKernel.php(191): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('kernel.response', Object(Symfony\Component\HttpKernel\Event\FilterResponseEvent)) #12 /vagrant/drupal/vendor/symfony/http-kernel/HttpKernel.php(173): Symfony\Component\HttpKernel\HttpKernel->filterResponse(Object(Drupal\jsonapi\ResourceResponse), Object(Symfony\Component\HttpFoundation\Request), 1) #13 /vagrant/drupal/vendor/symfony/http-kernel/HttpKernel.php(68): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1) #14 /vagrant/drupal/web/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #15 /vagrant/drupal/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #16 /vagrant/drupal/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(99): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #17 /vagrant/drupal/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(78): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true) #18 /vagrant/drupal/web/modules/contrib/jsonapi/src/StackMiddleware/FormatSetter.php(41): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #19 /vagrant/drupal/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\jsonapi\StackMiddleware\FormatSetter->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #20 /vagrant/drupal/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(52): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #21 /vagrant/drupal/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #22 /vagrant/drupal/web/core/lib/Drupal/Core/DrupalKernel.php(669): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #23 /vagrant/drupal/web/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request)) #24 {main}.
Marking priority higher than normal only because as this page isn't accessible - it crashes out Gatsby (jsonapi data source based) project build process.
Comments
Comment #2
phonoman commentedSorry, I just noticed that we're having jsonapi_extras 8.2.0 atm. Will test with 8.3.0 before reacting returning to this..
Comment #3
wim leersThanks for #2 :)
Because I definitely cannot reproduce this with vanilla Drupal 8 + JSON:API 2.0-RC3.
Comment #4
phonoman commentedAfter testing with the ACTUALLY latest versions of jsonapi && extras, saddly, I didn't notice any changes at all.. It still errors out the same way for our site. (Jsonapi_extras 8.3.0 && jsonapi 8.2.0-rc3 )
However, what I did find out is that any verison of jsonapi_extras (2.11/2.14/3.0) work fine with jsonapi(2.0-rc2) and the /jsonapi/user/user page only crashes for us upon installing jsonapi(2.0-rc3).
Comment #5
wim leersFresh D8 site + JSON:API 2.0-RC3 + JSON:API Extras 3.0. Reproduced.
EntityNormalizerValue::getValues()returns['name' => NULL]for the anonymous user, which then failsEntityNormalizerValue::getValues()is never called for the anonymous user, becauseLabelOnlyEntityNormalizeris used instead.So something in JSON:API Extras 3.0 is causing this behavior change in JSON:API.
Comment #6
wim leersI think #3020237: [Regression] Broken with latest jsonapi 2.0-rc3 fixed this.
Comment #7
e0ipsoYay!
Marking as fixed. If you don't think this is fixed, please request a reopen.