Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

Validation error of type FieldUndefined: Field 'XXX' in type 'QueryType' is undefined, when persisting GraphQL query

Avatar

Level 1

I am trying to save a persisted query in AEM's GraphiQL Explorer. 

I can run the query fine, as seen on the right side results.

 

QTke2.png

But if I try "Save As", I get the following error. "Validation error of type FieldUndefined: Field 'adventureList' in type 'QueryType' is undefined"

 

2.png

I also tried named query, but no avail.

 

query getAdventures {
  adventureList {
     items {
       _path
       adventureTitle
       adventurePrice
       adventureTripLength
       adventurePrimaryImage {
         ... on ImageRef {
           _path
           mimeType
           width
           height
         }
       }
     }
  }
}
Although I am new to GraphQL, I wonder if this may have to do with GraphiQL tool. Why is it giving me such an error during saving, when I can execute the query fine?
 
I am loosely following the tutorial here.
 
Thank you, 
1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

Can you add the screen shot of the error you mentioned above.

 

Also, please check, following things are in sync on both publisher and author:

1. Content Fragment Models

2. Content Fragments

3. Persisted Queries

@kharman 

View solution in original post

4 Replies

Avatar

Level 1

Hello, I was able to persist the query but after a while, the error came in the publisher logs. The query runs fine on the Author though. Env : AEM Cloud.

Avatar

Employee Advisor

@kharman 

Not sure how you fixed this on Author. Probably same config need to be published to Publisher.
Please find below link, to evaluate if your GraphQL Endpoints and Persisted GraphQL queries are accessible. 
https://experienceleague.adobe.com/docs/experience-manager-cloud-service/content/headless/graphql-ap...

Also, another link that elaborate on Publishing Persisted Queries

https://experienceleague.adobe.com/docs/experience-manager-cloud-service/content/headless/graphql-ap...

 

 

Avatar

Level 1

The end-point itself is accessible.

We did not get this error on Author.

We got it in publish.

The error in the publisher logs says <ContentModel_1> does not have the field <fieldName1>.

This <ContenModel_1> is not present in author.

We attempted to fix this by creating a dummy model with this name and publishing, but no luck yet.

 

Avatar

Correct answer by
Employee Advisor

Can you add the screen shot of the error you mentioned above.

 

Also, please check, following things are in sync on both publisher and author:

1. Content Fragment Models

2. Content Fragments

3. Persisted Queries

@kharman