Coming from #2945393: setRelatableResourceTypes() must be called before getting relatable resource types.
The ConfigurableResourceTypeRepository does not call ResourceType::setRelatableResourceTypes() when it first builds its overridden resource types. This causes an exception when used w/ the latest security release of the JSON API module.
Original report from JSON API:
Hi,
I have a taxonomy vocab that I am trying to request via jsonapi and keep getting the following error..{"errors":[{"title":"Internal Server Error","status":500,"detail":"setRelatableResourceTypes() must be called before getting relatable resource types.","links":{"info":"http:\/\/www.w3.org\/Protocols\/rfc2616\/rfc2616-sec10.html#sec10.5.1"},"code":0}]}
| Comment | File | Size | Author |
|---|---|---|---|
| #13 | interdiff-commit.txt | 922 bytes | e0ipso |
| #2 | 2946790-2.patch | 747 bytes | gabesullice |
Comments
Comment #2
gabesulliceComment #3
swentel commentedTried it out, but now getting: Error: Call to a member function isInternal() on null in Drupal\jsonapi\Normalizer\Value\RelationshipNormalizerValue::hasNonInternalResourceType() (line 120 of /home/drupal/modules/jsonapi/src/Normalizer/Value/RelationshipNormalizerValue.php)
Comment #4
swentel commentedIn case you want to whole strack trace:
Comment #5
vtcore commented#2 works for me.
Comment #6
mkolar commentedHello, same error with version drupal/jsonapi 8.x-1.10 and druapl/jsonapi_extras dev-1.x (ref c2d0f5368a8a19b5aa4f525977ca62d62d7362d6)... #2 fixed the issue.
Comment #7
mkolar commented@swentel do you use drupal/jsonapi_defaults module? Looks like issue is here https://www.drupal.org/project/jsonapi_defaults/issues/2946892
Comment #8
prineshazar commentedI can confirm #2 is working for me also.
Comment #9
swentel commentedHmm, no, don't use the default module. In terms of overrides, I basically disabled all resources, except for 3 collections being the article, image and page (nodes).
Comment #10
mkolar commentedOK I've look at this again with my module disabled (because jsonapi_defaults overrides jsonapi services)... Looks like when i try to use include manualy in url for example field_categories (relation to taxonomy term) i have error "Call to a member function isInternal() on null".. if I try to include uid or paragraphs (i have them in the node) it works..) it crashes on the same error as you have.. looks like jsonapi has broken include argument now for some entities!.. @swentel do you use includes or just resource without any argument? try to remove include if so
Comment #11
mkolar commentedcreated https://www.drupal.org/project/jsonapi/issues/2946969 since this issue is related to jsonapi module itself not extras
Comment #12
e0ipsoI'm going to merge this and move the conversation over to the other issue: #2946969: Error: Call to a member function isInternal() on null (RelationshipNormalizerValue.php)
Comment #13
e0ipso