Hello,
I am having an issue with a custom component that is not rendering on the publish server but renders fine on the author server. Here are the different combinations that I have tried to get it to work.
It always renders on the Author instance no matter what. We have different portals set up in our site structure, let's call them portal A and B. If I put the component on a site in Portal A, it also always renders correctly. However, when I put the component in Portal B's site pages, it does not work on the Publish instance.
This behavior makes me think it could be a config but I have looked and it seems like both portals have the same configuration.
Is there another possibility? Or is there a way that I can debug?
Solved! Go to Solution.
Views
Replies
Total Likes
This was caused by an issue with shared and global component properties.
Through debugging I figured out that the problem was some properties injected like this:
@SharedValueMapValue(injectionStrategy = InjectionStrategy.OPTIONAL)
private String str;
They were always null on Portal B on the publish instance. Our setup had @SharedValueMapValue properties get added to the root path in our site structure, and the issue was that root page did not get published. So that's why it worked on Portal A, because the root page was published as well as the page that had the component in question.
It seems to me that your component relies on some content that may not be available in the publish instance. That's why it could be breaking. If you have the code, the best thing to do is to check what this component is doing, if it is reading some content or needs extra configurations, additionally, you should check the logs to see if there is any additional information.
Hope this helps
Hey Esteban,
I have some more information that I just figured out. I am getting this error in the logs:
12.06.2024 15:50:24.465 *INFO* [qtp2098876788-2488723] org.apache.sling.auth.core.impl.SlingAuthenticator getAnonymousResolver: Anonymous access not allowed by configuration - requesting credentials 12.06.2024 15:50:24.470 *WARN* [qtp2098876788-2488723] org.apache.sling.auth.core.AuthUtil isRedirectValid: Redirect target must not be empty or null
I am getting this on the publish instance only. Could this be a clue as to what the problem could be? It seems like whatever the component is doing it doesn't have access to get the Resolver object.
Hey @rkody, I don't think that is related to your issue. The best thing to do is to understand what your component is doing. Check if this has a Sling model, if this depends upon OSGi services, if there are any JavaScript that may be failing, etc. etc. It is hard to advise without knowing what your component does, but I am sure if you can debug and understand what pieces are joining together within your component you will know which one is failing. Please check this tutorial in case you don't know how to debug:
https://jimfrenette.com/2019/12/aem-app-debug-visual-studio-code/
https://aemgeeks.com/aem-debugging/how-to-start-aem-in-debug-mode/
If debugging is not an option because the issue is not reproducible locally, you could increase the logging statements wherever you feel suspicious the issue may be occurring and then check the logs once more.
Hope this helps!
Hi @rkody ,
Can you please check on the following:
1) If there are any logs related to your component on publish server
2) Try to replicate same on local publish server.
3) If it works fine in local publish, and if there are no errors, please flush the dispatcher cache and check.
Hi @rkody ,
The issue you're experiencing, where a custom component renders on the author instance but not on the publish instance (particularly in one specific portal), can be caused by several factors. Here are steps to help you debug and potentially resolve this issue:
The dispatcher configuration can sometimes block specific resources or requests. Ensure that the dispatcher is not blocking the custom component's resources:
Ensure that both portals (A and B) have identical configurations in terms of client libraries, OSGi configurations, and permissions:
Ensure that the component and its dependencies have the correct permissions:
Check the error logs on the publish instance for any clues:
Use browser developer tools to inspect the network requests and console logs:
Ensure that the content and configurations are correctly synchronized between the author and publish instances:
AEM provides tools for debugging query-related issues:
Ensure the component and its template paths are correctly resolved on the publish instance:
/your-dispatcher-path/logs/dispatcher.log
Inspect Error Logs on Publish Instance
<your-publish-instance>/crx-quickstart/logs/error.log
Use AEM's Web Console Configuration to compare OSGi configurations:
http://<publish-instance>:4502/system/console/configMgr
By systematically going through these steps, you should be able to identify and resolve the issue preventing your custom component from rendering on the publish instance.
Thank you for your reply.
I have looked into these steps and the only issue that I have found was by putting more logs into the component and then deploying locally, because the issue is replicated on my local instance as well.
I have an init function in the component code that has this line:
String[] selectors = slingRequest.getRequestPathInfo().getSelectors();
//Added logger line
LOGGER.info(String.valueOf(slingRequest.getRequestPathInfo()));
Based on the logs I have this on Author and publish respectively:
2024-06-05 10:57:25.688 INFO [component] SlingRequestPathInfo: path='/content/.../jcr:content/root/main-par/section-wrapper/article-list', selectorString='load.1', extension='html', suffix='null'
2024-06-05 11:08:58.382 INFO [component] SlingRequestPathInfo: path='/content/.../jcr:content/root/main-par/section-wrapper/article-list', selectorString='null', extension='html', suffix='null'
So for some reason the selectorString is different and based on the component code it depends on the selector values.
@rkody Did you find the suggestions from users 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!
Views
Replies
Total Likes
I did not find the answers to be useful in solving my issue yet. I provided a couple follow ups to the replies but have not received a response. This is still open but i will be updating when I figure it out.
This was caused by an issue with shared and global component properties.
Through debugging I figured out that the problem was some properties injected like this:
@SharedValueMapValue(injectionStrategy = InjectionStrategy.OPTIONAL)
private String str;
They were always null on Portal B on the publish instance. Our setup had @SharedValueMapValue properties get added to the root path in our site structure, and the issue was that root page did not get published. So that's why it worked on Portal A, because the root page was published as well as the page that had the component in question.
That's exactly what my first comment mentioned, you probably missed some content in the publish instance, I'm glad you figured it out.
Views
Like
Replies