AEM GraphQL query "FieldUndefined" error | Community
Skip to main content
Level 2
July 18, 2024
Solved

AEM GraphQL query "FieldUndefined" error

  • July 18, 2024
  • 5 replies
  • 2345 views

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"

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by karthik-elumalai

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!

5 replies

MukeshYadav_
Community Advisor
Community Advisor
July 18, 2024

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

 

Level 2
July 18, 2024

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

h_kataria
Community Advisor
Community Advisor
July 19, 2024

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.

Level 2
July 24, 2024

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?

kautuk_sahni
Community Manager
Community Manager
July 23, 2024

@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
karthik-elumalaiAuthorAccepted solution
Level 2
July 24, 2024

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!

RahulBGPandey
Level 2
July 24, 2024

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

Level 2
July 24, 2024

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

Level 2
May 12, 2025

I am having the same issue and restarting the bundle is the only thing that works which is pretty not a solucion. I am not sure why that operation was accepted as an answer, it is more like a work-around to me!!!!!