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

GraphQL is not working correctly on Publish (Stage)

Avatar

Level 3

Hello, good afternoon.

 

We are having a particular problem. We are in the Stage environment, we want it to load some content fragments through GraphQL but in Author it works and in Publish it doesn't.

 

We have tried to publish everything, Endpoints, Content Models, Queries, Fragments, absolutely everything, but when it is executed in Publish it does not return any data.

 

The strange thing is that it works for one of our teammates and not for the rest, we have tried to clear the cache and nothing.

Does anyone comes up with something?

 

Thank you so much.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

@Alex_Terinte If you are using the AEMaaCS, the cache has to be cleared by creating the support ticket and asking the team to get the cache cleared.

Otherwise you can comment the line '/enableTTL "1"' in teh farm file present in the location "dispatcher\src\conf.dispatcher.d\available_farms".

 

The TTL refers to the OSGi configuration - com.adobe.acs.commons.http.headers.impl.DispatcherMaxAgeHeaderFilter for adding Cache-Control: max-age=60

 

Reference Document - https://github.com/adobe/aem-dispatcher-experiments/blob/main/experiments/enableTTL/README.md

 

Hope this helps!

Thanks

View solution in original post

8 Replies

Avatar

Community Advisor

Hi @Alex_Terinte ,

 

Which AEM version you are using? Are you able to access the content fragment data without GraphQL APIs? Are you getting any error while running the query (in logs/network call)?

 

Thanks,

Ritesh Mittal

 

 

Avatar

Level 3

Hi @Ritesh_Mittal.

We have version "2023.3.11382.20230315T073850Z" on Stage.

 

We are accessing the API through Fetch to collect the data, it does not give any errors, we have reviewed the LOGS of the environment and everything seems to be perfect.

 

The problem is that it doesn't return any data.

I reiterate, in Author it loads the data but in Publish it doesn't.

 

And if you mean that if we can access the data through "Assets" -> "Files" the answer is yes, we can see and create models.

 

Thank you.

Avatar

Community Advisor

@Alex_Terinte "GraphQL queries are executed with the permission of the AEM user of the underlying request. If the user does not have read access to some fragments (stored as Assets), they will not become part of the result set.The user needs to have access to a GraphQL endpoint to be able to execute GraphQL queries."
https://experienceleague.adobe.com/docs/experience-manager-cloud-service/content/headless/graphql-ap...

If the permissions and configuration are correct as per documentation, can you check on which publisher pod your request lands on.

Check your Distribution Agent (Replication Queue) to identify the number of publisher pods active at that time, if you are replicating the data there might be a chance that the data has not been replicated to the publisher pod your request lands on. 

Try republishing, check all the replication queue is processed completely, then try and fetch the data.

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

Avatar

Level 3

@shubhanshu_singh 


The users who are publishing are administrators, they belong to the Administrators group, so permissions cannot be dealt with.

 

And as you say, what is published goes to a queue, I think that this is failing, that it is not finished even though the program marks the publication as finished.

 

Since some things that we published 3 days ago are just appearing.

 

We have tried to unpublish and republish many times, the publication queue detects the change and in the LOG marks the publication as correct, but in publish it is not referenced until several days have passed

 

The problem is that we can't wait that long to see the changes referenced in publish

 

 

Avatar

Employee Advisor

Hi,

 

It sounds like there may be a caching issue at play here. One possible solution is to try clearing the cache on the publish instance, either manually or through a script. You may also want to check if there are any differences in the configurations between the teammate for whom it works and the rest of the team. Additionally, check the server logs on the publish instance to see if there are any errors being reported that could be related to the GraphQL query.

Avatar

Level 3

@ManviSharma 


Well, it must be a problem with the cache or with the publication queue, since the changes are taken after several days.

Although sometimes it works, other times it fails, etc.

 

It's quite rare, if you can provide me with some more information on how to clear the cache of the publish instance or something that may be related, I would be very grateful.

Avatar

Correct answer by
Community Advisor

@Alex_Terinte If you are using the AEMaaCS, the cache has to be cleared by creating the support ticket and asking the team to get the cache cleared.

Otherwise you can comment the line '/enableTTL "1"' in teh farm file present in the location "dispatcher\src\conf.dispatcher.d\available_farms".

 

The TTL refers to the OSGi configuration - com.adobe.acs.commons.http.headers.impl.DispatcherMaxAgeHeaderFilter for adding Cache-Control: max-age=60

 

Reference Document - https://github.com/adobe/aem-dispatcher-experiments/blob/main/experiments/enableTTL/README.md

 

Hope this helps!

Thanks