I am currently trying to get the my GraphQL endpoint set up for my Preview service. I have gone to Deployment -> Distribution -> preview -> Distribute and added my endpoint and models with successful responses from the logs. I have also publish out the content to the Preview service and the GraphQL persisted Query to Preview. However, I keep getting the following error:
*ERROR* GET /graphql/execute.json/xxxxx/persistedQuery;pathVariable=/content/dam/xxx/xx/xx/xxx HTTP/1.1] com.adobe.aem.graphql.impl.servlet.PersistedQueryServlet Error processing persisted query: status code - 500, details - "errors":"errorType":"QueryValidationError","message":"Persisted Query Validation Error","details":"invalid schema:\n\"QueryType\" must define one or more fields."
I have tried deleting and re-adding with no success. I have tried creating a new persisted query but that has a different structure but still nothing.
When I publish the content to production as well as the GraphQL query it works fine. Not sure what the disconnect is. It seems to be having problems with the root Object for the objects that being 'QueryType' (see below). It leads me to believe some sort of package for graphql is not enable for preview service
When I click on the above QueryType it shows me all the defined models available for Querying.
A similar post that I followed for this setup was https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/graphql-endpoint-not-worki...
Thanks
Solved! Go to Solution.
Views
Replies
Total Likes
I was able to solve this by following this issue https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/publishing-to-preview-envi...
In there they have a reference to a blog https://www.albinsblog.com/2018/02/approach-to-implement-content-preview-in-adobe-experience-manager...
I was able to take the script provided and create a workflow using 'preview' as the argument for the script in workflow. Luckily that worked. I then went through every model (about 10) and started a workflow for each one and published them out.
I am still confused as to why going through the Distribution (Deployment -> Distribution -> preview -> Distribute) didn't work though. When the workflow had finished I was able to go there and look at the logs for the preview target. The logs were the same saying it was successful just like when I ran it through the distribution. But the difference this time was it actually worked
Views
Replies
Total Likes
Hi @robertstull ,
The error you're encountering indicates that the GraphQL endpoint in the AEM Preview service is having issues with the schema, specifically the QueryType not defining any fields. This often points to a configuration issue or a problem with how the models are set up and distributed to the Preview service.
Here are steps to troubleshoot and resolve the issue:
Ensure that the GraphQL schema in your Preview environment is correctly set up and includes all necessary fields. The schema must define one or more fields for the QueryType.
Confirm that the models have been correctly distributed to the Preview environment:
Ensure that the content has been published correctly to the Preview service:
Make sure that the persisted queries are correctly set up and published to the Preview service:
Check your AEM GraphQL configuration for any discrepancies between your production and preview environments:
Enable detailed logging for the GraphQL services to get more insights into what might be going wrong:
This will provide more detailed logs that can help identify the root cause of the issue.
Check Model Configuration:
Update GraphQL Endpoint Configuration:
curl -u admin:admin -F operation=publish -F path=/conf/global/settings/graphql/environments/preview -F recursive=true http://localhost:4502/bin/wcmcommand
Validate Schema:
{
__schema {
queryType {
name
fields {
name
}
}
}
}
Compare Production and Preview Schema:
By following these steps and validating configurations, you should be able to identify and resolve the issue causing the QueryType to lack defined fields in the Preview environment. If the problem persists, consider reaching out to Adobe Support for further assistance.
Thank you for the detailed response.
I have tried most of the steps that you have mentioned. I think my next step is to set up the preview service locally since some of the steps you have outlined are not available for me to access in production environment such as the AEM Web Console: /system/console/configMgr. I know my models are correct as well as my queries since they run fine when I test them in Production. Therefore it must be some sort of configuration issue. I will open a support ticket. Thanks again!
Views
Replies
Total Likes
I was able to solve this by following this issue https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/publishing-to-preview-envi...
In there they have a reference to a blog https://www.albinsblog.com/2018/02/approach-to-implement-content-preview-in-adobe-experience-manager...
I was able to take the script provided and create a workflow using 'preview' as the argument for the script in workflow. Luckily that worked. I then went through every model (about 10) and started a workflow for each one and published them out.
I am still confused as to why going through the Distribution (Deployment -> Distribution -> preview -> Distribute) didn't work though. When the workflow had finished I was able to go there and look at the logs for the preview target. The logs were the same saying it was successful just like when I ran it through the distribution. But the difference this time was it actually worked
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies