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.
SOLVED

AEM GraphQL query "FieldUndefined" error

Avatar

Level 2

I have created Content Fragment Model and its related GraphQL Query in my local AEM and synced with code base and deployed into AEM Servers (TEST & PROD), GraphQL Query working fine till TEST but not working in PROD.

 

I am seeing some inconsistent like same code of Content Fragment Model & GraphQL Query working fine in one AEM environment but not working in another environment.

 

AEM Version: 6.5.19

Error Details: "Validation error of type FieldUndefined: Field 'name' in type 'UserModel' is undefined"

1 Accepted Solution

Avatar

Correct answer by
Level 2

Hi @kautuk_sahni ,

Thanks for checking in, actually this code start working after refreshing bundle "Adobe Experience Manager GraphQL for Content Fragments" in AEM but my concern is we cant refresh bundle in PROD every deployment right, also after refreshing the bundle, if its start working means there is no issue in code also its working in other environments so is there anything we can fix in AEM level, please suggest. Thanks!

View solution in original post

8 Replies

Avatar

Community Advisor

Hi @karthik-elumalai ,

You may cross check if schema model is defined correctly, if your are deploying hat model make sure it is correctly deployed, published and available.

Seems name field is not present in UserModel schema that environment if that field is not required you may discard that field from query.

Thanks

 

Avatar

Level 2

@MukeshYadav_  Thanks for your reply, actually i am having this Content Fragment Model and GraphQL query in code base, after deployment that same code working in ENG but not working in TEST. 

Avatar

Community Advisor

Few points to check :
Are the AEM versions same for both the environments ? (working and non working one ) 
Apart from the CFM and persisted query, can you also cross check if the respective graphql endpoint is also present on your environments generally located at /content/cq:graphql
You can open the persisted query in the graphql editor on the environment on which you are facing the issue. If there are any errors with respect to your query/schema validation, you should be able to see the errors in the editor itself and can work on it accordingly. 
If possible, please share the Graphql query and CFM.

Avatar

Level 2

Hi @h_kataria ,

its a working query in another environment, if we move that working query to different environment through code deployment, its throwing error in editor and everywhere. also i have installed GrapahQL indexing package in AEM. is that something issue with product level?

Avatar

Administrator

@karthik-elumalai Did you find the suggestion helpful? Please let us know if you require more information. Otherwise, please mark the answer as correct for posterity. If you've discovered a solution yourself, we would appreciate it if you could share it with the community. Thank you!



Kautuk Sahni

Avatar

Correct answer by
Level 2

Hi @kautuk_sahni ,

Thanks for checking in, actually this code start working after refreshing bundle "Adobe Experience Manager GraphQL for Content Fragments" in AEM but my concern is we cant refresh bundle in PROD every deployment right, also after refreshing the bundle, if its start working means there is no issue in code also its working in other environments so is there anything we can fix in AEM level, please suggest. Thanks!

Avatar

Level 2

Hi @karthik-elumalai ,

 

You can check if your content fragment models are up to date with the deployment. Sometimes it does not get updated on AEM instances due to package filter's mode.

 

Thanks

Avatar

Level 2

Hi @RahulBGPandey 

Thanks for your reply, but its was working code in another environment. so it means is there any issue in AEM internally to register these models