Our case has more parts, so I reduced it to fresh install as POC. Start with fresh site install, enable jsonapi. Then:
1) Create a new content type "Composite"
2) Add an Entity Reference Field to if ("field_target_node")
3) Query content type in jsonapi based on title `http://localhost:8888/jsonapi/node/composite?sort=field_target_node.title`
With jsonapi 1.3:
{
"data": [],
"links": {
"self": "http://localhost:8888/jsonapi/node/composite?sort=field_target_node.title"
}
}
With jsonapi 1.4:
The website encountered an unexpected error. Please try again later.
[moved possibly incorrect stack trace to separate file]
_ field.field.node.composite.field_target_node.yml _
uuid: 46c895c7-2ab6-4007-b6a1-b076ed5d3f20
langcode: en
status: true
dependencies:
config:
- field.storage.node.field_target_node
- node.type.article
- node.type.composite
- node.type.page
id: node.composite.field_target_node
field_name: field_target_node
entity_type: node
bundle: composite
label: 'Target Node'
description: ''
required: false
translatable: false
default_value: { }
default_value_callback: ''
settings:
handler: 'default:node'
handler_settings:
target_bundles:
article: article
page: page
sort:
field: _none
auto_create: false
auto_create_bundle: article
field_type: entity_reference
_field.storage.node.field_target_node.yml_
uuid: 1222b9ad-d615-41b1-9e29-a37ef646c86b
langcode: en
status: true
dependencies:
module:
- node
id: node.field_target_node
field_name: field_target_node
entity_type: node
type: entity_reference
settings:
target_type: node
module: core
locked: false
cardinality: 1
translatable: true
indexes: { }
persist_with_no_fields: false
custom_storage: false
Comments
Comment #2
e0ipsoThanks for the detailed report.
We will need:
Comment #3
gabesulliceI've tried to replicate this issue and wasn't able to. Given the following error message:
This issue looks like the DI container is out of date/broken. It could be and indication that files weren't completely cleaned up during the update from 1.3 to 1.4 or that your cache hasn't yet been rebuilt.
@kdebisschop, can you completely remove jsonapi and then reinstall 1.4? Not going to 1.3 first? Then rebuild the cache?
Thanks for your help debugging this!
Comment #4
kdebisschop commentedI updated composer and then did a complete site install. The message I got is different, but it still fails. So there was something wrong about the way I tried to simply the conditions.
The trace of the new (and correct error) is attached as the full JSON and just the exception as "exception.txt". This is much better as it is a dead-on match in this test case with a fresh site install for the error we are actually seeing in development.
If it helps, I should be able to export this scheme as a module with a kernel test, or at least a functional test if not a kernel test.
Comment #5
kdebisschop commentedComment #6
gabesulliceHey @kdebisschop, when I was trying to replicate your example, I found the same bug and already fixed it :D
That's just been fixed and committed here: #2932266: fix(SortNormalizer): Path expansion/field resolution no longer performed for sort parameters
That means you can apply the patch or upgrade to the dev version. Thank you for your thorough bug reports, they're super helpful!
Comment #7
wim leers