Open de-shine opened 1 year ago
I have the same problem, so I try to add more details.
I investigated deeply and I discovered that the bug is caused by the endpoint /content-manager/single-types/api::homepage.homepage/actions/numberOfDraftRelations
, called before the publish action. The method that throws the exception is this one.
To reproduce the bug, it's necessary to have a content type (single or collection) with the following schema:
{
"kind": "singleType",
"collectionName": "examples",
"info": {
"singularName": "example",
"pluralName": "examples",
"displayName": "Example",
},
"options": {
"draftAndPublish": true
},
"pluginOptions": {},
"attributes": {
"body": {
"type": "dynamiczone",
"components": [
"test.component-one",
"test.component-two",
]
}
}
}
The schema for test.component-one
is:
{
"collectionName": "components_unit_banner_authors",
"info": {
"displayName": "Banner Author",
"description": ""
},
"options": {},
"attributes": {
"item": {
"type": "component",
"component": "test.component-three",
}
}
}
And the schema for test.component-two
is:
{
"collectionName": "components_unit_banner_authors",
"info": {
"displayName": "Banner Author",
"description": ""
},
"options": {},
"attributes": {
"item": {
"type": "relation",
"relation": "oneToOne",
"target": "api::relation.relation",
}
}
}
Both components have the field item
but
test.component-one
specifies a componenttest-component.two
specifies a relationThe method linked above generates query filters for each field of the dynamic zone but in that case is merging them because they have the same name. The final result returns a filter on the publishedAt: { $null: true }
for the items
field. The query fails while checking if there is any draft relation for test.component-one
because the field is not a relation.
The issue is similar to another one already resolved: https://github.com/strapi/strapi/issues/11955
I hope that this comment is clear and can be useful for the resolution.
We are getting below error on console while trying to publish a collection type having a dynamic zone as one of its field type, inside which we use a component carousel (i.e. containing another child component 'Image' within it).
Component Detail and folder Structure: Inside /src/components/content carousel.json:
image.json:
Steps to reproduce the behavior
-If we use above content.carousel component in a dynamic zone field type of a collection type field , we encountered this error with the below log.
error log:
Test cases: Scenario 1 : - If the collection type is already in published state - No ERROR- It publish successfully. Scenario 2 : - If the collection type is not published yet- We get ERROR (see logs above). Publish fails.
Required System information
Kindly help in fixing this.