umbraco / Umbraco.Heartcore.Issues

3 stars 1 forks source link

GraphQL returns an error when querying a media folder for a video media item but the folder contains a file media item #109

Closed wvankesteren-ax closed 10 months ago

wvankesteren-ax commented 1 year ago

Issue description

see support ticket https://support.umbraco.com/hc/en-us/requests/84532.

We have a consultant document type with links to an image folder and a video folder.

When using a graphQL query to get data about a consultant, including the images in the imagesFolder and the videos in the videosFolder, there is an error stating it can't resolve the field node from the videosFolder field.

When there is no videosFolder linked, then the query is successfull.

Query:

'query GetConsultant { consultant(id: "93ec15cf-3bb3-41c7-821c-46c3c2e2227e") { id

consultantId cluster { ...GetCluster }

consultantName consultantEmail

complexNumberTechnical

imagesFolder { ...GetImagesFolder } videosFolder { ...GetVideosFolder } } }

fragment GetCluster on Cluster { id url

clusterName complexNumberTechnical }

fragment GetImagesFolder on Folder { id name

children { edges { node { ...GetImage } } } }

fragment GetImage on Image { id url umbracoFile { ...GetImageCropper } }

fragment GetImageCropper on ImageCropper { cropUrl(width: 125, height: 70) }

fragment GetVideosFolder on Folder { id name

children { edges { node { ...GetVideo } } } }

fragment GetVideo on Video { id url umbracoFile }'

Error:

'{ "errors": [ { "message": "Error trying to resolve field 'node'.", "locations": [ { "line": 56, "column": 7 } ], "path": [ "consultant", "videosFolder", "children", "edges", 0, "node" ] } ], "data": { "consultant": { "id": "93ec15cf-3bb3-41c7-821c-46c3c2e2227e", "consultantId": "any-unique-id", "cluster": { "id": "33bf4d98-8ea6-4f5a-bb4e-4ac11ba0bcc9", "url": "/data/clusters/cluster-5/", "clusterName": "Cluster 5", "complexNumberTechnical": [ "100502", "100502", "100502", "100502", "103301", "103301", "103301", "103301", "103702", "103702", "103702", "103702", "103703", "103703", "103703", "103903", "103903", "103903", "104302", "104302", "104302", "104303", "104303", "104303", "107602", "107602", "107602", "107603", "107603", "107603", "107604", "107604", "107604", "110002", "110002", "110002", "110003", "110003", "110003", "110004", "110004", "110004", "111201", "111201", "111201", "111202", "111202", "111202", "112501", "112501", "112501", "119201", "119201", "119201", "131801", "131801", "131801", "148102", "148102", "148102", "148103", "148103", "148103", "148104", "148104", "148104", "148201", "148201", "148201", "148801", "148801", "148801", "153802", "153802", "153802", "194501", "194501", "194501", "194502", "194502", "194502", "3690202", "3690202", "3690202", "3690203", "3690203", "3690203", "3690302", "3690302", "3690302", "8805401", "8805401", "8805401", "8805402", "8805402", "8805402", "8805404", "8805404", "8805404", "8809901", "8809901", "8809901", "8811701", "8811701", "8811701", "8818501", "8818501", "8818501", "8818502", "8818502", "8818502", "8856001", "8856001", "8856001", "8856002", "8856002", "8856002", "8856003", "8856003", "8856003" ] }, "consultantName": "Rebecca van der Ploeg", "consultantEmail": "r.van.der.ploeg@woonzorg.nl", "complexNumberTechnical": [ "110002", "194502", "103702", "103301" ], "imagesFolder": { "id": "f80d5dfd-b753-4962-9162-23416048b89e", "name": "Images", "children": { "edges": [ { "node": { "id": "077ab7e8-8135-4b00-a764-91d85df422ea", "url": "https://media.umbraco.io/dev-woonzorg-nederland/301hubzv/axendo-logo.png", "umbracoFile": { "cropUrl": "https://media.umbraco.io/dev-woonzorg-nederland/301hubzv/axendo-logo.png?anchor=center&mode=crop&width=125&height=70&upscale=false" } } }, { "node": { "id": "fa75673a-8eda-4a2d-a5b5-4c4495d73dd6", "url": "https://media.umbraco.io/dev-woonzorg-nederland/hrthl4w0/screenshot-2023-07-03-145502.png", "umbracoFile": { "cropUrl": "https://media.umbraco.io/dev-woonzorg-nederland/hrthl4w0/screenshot-2023-07-03-145502.png?anchor=center&mode=crop&width=125&height=70&upscale=false" } } } ] } }, "videosFolder": { "id": "3c416759-b70e-47bc-940c-2e27d5cc3db9", "name": "Videos", "children": { "edges": [ { "node": null } ] } } } } }'

The cause of above issue:

When renaming the linked folder to Videos [Old] and linked an new folder, Videos [nieuw] and then the query worked.

It turns out that the (old) folder contains a file and not a video.

Hence, somehow the query can not handle nodes of different content types.

Currently it is not possible (as far as I can see) to make a distinguishment based upon contentType in the query. That also means that you can not mix contentTypes in the same folder.

Although there is an alternative solution (make sure to only have nodes with the same expected content type in the folder), I would like to see that improvements will be made on this:

or even better:

fix it, so that there will be no error message!

jmf-umbraco commented 11 months ago

Hi @wvankesteren-ax, thanks for your report!

We will investigate and see whether we are able to reproduce the problem you describe.

jmf-umbraco commented 10 months ago

We have been unable to reproduce this on a new instance, but were able to artificially create the right circumstances for the problem to occur locally. We think that this is likely a result of a message to the Heartcore content delivery platform that was not handled successfully, leaving some data in a bad state.

If you hit the save button on your affected media types (file / image / video) to re-trigger sending their definitions to the delivery platform then you should see your query succeed. If not, please request to re-open your support ticket as this is an issue that likely pertains to your site only.

Hopefully the suggested fix works, but I am going to close this issue as we don't believe it is an issue for other customers.