Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.

Content fragment models' Graphql querytypes not working after AEM upgrade to 6.5.15

Avatar

Level 3

We recently upgraded our AEM on-prem instance from version 6.5.9 to 6.5.15.

However, after the upgrade, we noticed that the Graphql querytypes for our old content fragment models stopped working on Author. We've tried to republish the GraphQL endpoint, disable and re-enable the CFMs, but it's still not working. 

When we run a graphql like this

{
  "query": "query {movieList {items {_path}}}"
}

, which used to run well on 6.5.9, it gets this error

{
  "errors": [
    {
      "message": "Validation error of type FieldUndefined: Field 'movieList' in type 'QueryType' is undefined @ 'movieList'",
      "locations": [
        {
          "line": 1,
          "column": 8
        }
      ],
      "extensions": {
        "classification": "ValidationError"
      }
    }
  ]
}

We checked the GraphQL tab in the CFM's properties and it shows the Multiple Query Field Name is exactly movieList. We also checked that the cfm-graphql-index-def-1.0.5.zip is properly installed. Can anyone help us identify the root cause of this issue and provide a solution? Thank you. 

5 Replies

Avatar

Employee Advisor

@wei_lyu 

Can you simply try:

query {
  movieList {
    items {
      _path
    }
  }
}

And is it an issue, when querying by path like 

{
  movieByPath(_path: "_cf_path") {
    item {
      _path
      title
      
    }
  }
}

 Also, is this error isolated to this particular CF Model. Have you tried with Sample CFs?

Avatar

Level 3

@krati_garg 

Thank you for your response. I attempted to use the faqList to query the faq model in we-retail and was successful. As I mentioned in my reply to @Siva_Sogalapalli 's comment, the schema generation in SP15 seems to be generating query types based on CFM titles instead of names, which is unexpected. Would you mind taking a look at this issue as well?

Avatar

Community Advisor

Hi @wei_lyu ,
Try to check if anything has changed around: 

1. Content Fragment Models

2. Content Fragments
and how it were in working condition.

Avatar

Community Advisor

I think you have to update update your graphql queries as well when you upgrade AEM to 6.5.15, 

prior to AEM 6.5.15, graphql was querying data based below properties of content fragment model but now it works based on content fragment model name itself.  

 

Siva_Sogalapalli_0-1682431616515.png

 

 

 

Avatar

Level 3

@Siva_Sogalapalli 

Thank you for your response. It appears that GraphQL is presently retrieving data based on the CFM's title rather than its name. I created a CFM named "test-model", then I titled it "Test Model Title". When I accessed the GraphiQL editor, only "testModelTitleList" was displayed, not "testModelList".

Is this the intended behavior?

wei_lyu_0-1682437972338.png

wei_lyu_1-1682438010872.png

 

In the event that this behavior is intentional, it has resulted in a subsequent issue. Our team has utilized Japanese characters for the CFM titles and English words for the names. However, this has led to the generation of GraphQL types such as "__List_2" for a CFM with the title "動画" (the name is "movie"). My guess is that the GraphQL system within SP15 does not function optimally with non-alphabet characters. Unfortunately, using a term like "__List_2" in our queries would be unclear to other developers. As such, do you have any suggestions for a possible solution or workaround?

wei_lyu_2-1682438695990.png