Problem/Motivation
I have been facing the following issue while working with JSON_API.
LengthException: Impossible to apply defaults on a related resource with heterogeneous resource types.
Drupal\jsonapi_defaults\Controller\EntityResource::correctResourceTypeOnRelated() (line 172 of /app/docroot/modules/contrib/jsonapi_extras/modules/jsonapi_defaults/src/Controller/EntityResource.php).Steps to reproduce
Create a taxonomy term with a Content override field type(named: text_override). Add multiple content types in the references.
Add a term in the above-created taxonomy term.
Hit the JSON API with the content override field. Request URI: /jsonapi//field_text_override
Comments
Comment #2
supriya1992 commentedComment #3
supriya1992 commentedComment #4
rveillard commentedHi, I'm reproducing the issue.
Here's some context on my use-case :
- A content "article" using a field
field_paragraphein which we can add a list of elements of typeparagraphs_type- Multiple implementations of this type (carrousel, video, image, podcast, ...)
When accessing the endpoint
/node/article/<uuid>/field_paragraphe, we are getting the same error.I can't find the reason of this error, as we were using the version 3.21 with Drupal 9.5 without any issues, and this is appearing now that we are moving to v3.23 on Drupal 10. This code doesn't seem to have been touched between those 2 versions.
Comment #5
adwivedi008 commented@rveillard Do you find any solution for this
I am also getting the same issue for video component
Comment #6
anul commentedComment #7
anul commentedComment #8
ptmkenny commentedMoving this to "Major" because it does not affect a majority of sites, which is a requirement for "Critical". Also bug reports generally need to be filed against the dev branch, so moving to 3.x-dev.
Comment #9
jeffreysmattsonThis error occurs when using the jsonapi_defaults module with entity reference fields that can reference multiple media types (heterogeneous resources). The module can't apply defaults when a field like field_gallery_slides can reference both /media/image and /media/remote_video.
I am also seeing this error. Have not found a good fix for it yet. But I am looking.