Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment | File | Size | Author |
---|---|---|---|
#23 | 3013544--interdiff--22-23.txt | 718 bytes | e0ipso |
#23 | 3013544--2.x-broken--23.patch | 15.02 KB | e0ipso |
| |||
#22 | 3013544--2.x-broken--22.patch | 14.58 KB | e0ipso |
| |||
#19 | 3013544--2.x-broken--19.patch | 9.65 KB | e0ipso |
Comments
Comment #2
e0ipsoCan you share your configuration? I don't think to be able to reproduce this with a clean install.
Comment #3
kil CreditAttribution: kil commentedHaving 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.
Comment #4
ashutoshsngh CreditAttribution: ashutoshsngh commentedFacing same issue on this route admin/config/services/jsonapi
Comment #5
labboy0276 CreditAttribution: labboy0276 at Tandem commentedUsing latest version on contenta which uses json_api_extras 2.11 results in this fun error on node view in the backend:
Rolling json_api_extras to 2.10 fixes the issue.
Comment #6
jebschiefer CreditAttribution: jebschiefer commentedI'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:
If I modify the request so that it has no query parameters (just a plain
GET /jsonapi/node/<content_type>
), I get this stacktrace:Rolling back to jsonapi_extras 2.10.0 works for me as others have noted.
Comment #7
superbiche CreditAttribution: superbiche as a volunteer commentedI confirm I can reproduce the issue with 2.11 and that rolling back to 2.10 fixes it
Comment #8
benjifisherThere may be more than one problem discussed here. I am seeing the error described in the second scenario described in #6.
Steps to reproduce
composer require drush/drush drupal/jsonapi_extras
.drush -y en jsonapi_extras
.wget http://my_site.com/jsonapi/taxonomy_term/tags
orwget 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:Checking the Drupal log (
drush ws
) I see the same error (node or term gives the same result):Code
Looking at the indicated lines, I see this:
Without digging into the code too much, I would expect
$this->configFactory
to be initialized in the class constructor. Instead, I see there is asetConfigFactory()
method. As the abbreviated stack trace shows, this is being called from the controller in thejsonapi
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.Comment #9
TwoDI 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.
Comment #10
benjifisher@TwoD:
This module (8.x-2.11 version) specifies
"drupal/jsonapi": "^1.22"
in itscomposer.json
, so it is hard to switch to the 2.x branch ofjsonapi
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.Comment #11
e0ipsoComment #12
e0ipso#3016725: Do not use cache.static just landed, can you test if
8.x-2.12
fixes the problems here?Comment #13
eojthebraveI'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.
Comment #14
gun_dose CreditAttribution: gun_dose at WBX Development commentedThe 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.
Comment #15
marc.groth CreditAttribution: marc.groth commentedSame issue here with the latest version of this module (2.14). Downgrading to 2.10 fixes it. That's with jsonapi version 1.23.
Comment #16
el1_1el CreditAttribution: el1_1el commentedUpdating 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 fixesComment #17
benjifisherAccording 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
.Comment #18
kil CreditAttribution: kil commentedWith 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):
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
Comment #19
e0ipsoLet's see if this works
Comment #20
e0ipsoCan anyone test the patch above?
Comment #21
benjifisherI 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.
Comment #22
e0ipsoThis should make tests green for JSON:API 1.x.
Comment #23
e0ipsoThis should keep tests green.
Comment #24
benjifisherDid 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.
Comment #26
e0ipso@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.
Comment #27
e0ipsoAccording to https://www.drupal.org/pift-ci-job/1156409 tests pass with the current version using D8.7
Comment #28
e0ipsoThis was released in 2.15
Comment #29
benjifisher@e0ipso:
I guess there was something broken on my site. I re-tested with
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.
Comment #30
e0ipsoThat's good news @benjifisher. Thanks for the feedback.
Comment #32
kil CreditAttribution: kil commentedSorry 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)