AEM 6.5.13 Clientlibs CSS and JS not being included on Pages in Edit or Preview as Published on Author
My client's AEM Author and Publish servers were originally AEM 6.3 and have been upgraded to AEM 6.5.13.
Currently, there is only 1 AEM site in production, which was originally developed on AEM 6.3 and has been upgraded to work on AEM 6.5.13.
This site uses the old static templates and the Client Library is in /etc/designs.
We are now developing a 2nd AEM site that will be deployed to the same AEM servers on Dev, QA, Stage, and Production.
The new site only uses the AEM Core Components and AEM Style System, map the CSS styles to the Core Components using the Page and Component Policies through the Page Template Editor.
On the developer's local AEM Author servers which are 6.5.13, the new site does display with CSS and JS which are generated from the Client Library and included on the page with the command
<sly data-sly-use.clientlib="core/wcm/components/commons/v1/templates/clientlib.html">
<sly data-sly-call="${clientlib.css @ categories='newsite.base'}"/>
</sly>
When you view the page source the CSS generated by the clientlib categories='newsite.base' is
<html lang="en">
<head>
<meta charset="UTF-8"/>
<title>en</title>
<meta name="template" content="home-page"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<link rel="canonical" href="/content/newsite/us/en.html"/>
<link rel="stylesheet" href="/etc.clientlibs/newsite/clientlibs/clientlib-base.css" type="text/css">
<script src="/etc.clientlibs/newsite/clientlibs/clientlib-dependencies.js"></script>
<link rel="stylesheet" href="/etc.clientlibs/newsite/clientlibs/clientlib-dependencies.css" type="text/css">
<link rel="stylesheet" href="/etc.clientlibs/newsite/clientlibs/clientlib-site.css" type="text/css">
<script async src="/etc.clientlibs/core/wcm/components/commons/datalayer/v1/clientlibs/core.wcm.components.commons.datalayer.v1.js"></script>
</head>
When the new site is deployed to the Dev, QA, and Stage AEM Author servers, the new site pages do not include the CSS in the <head> of the page.
<html lang="en">
<head>
<meta charset="UTF-8"/>
<title>en</title>
<meta name="template" content="home-page"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<link rel="canonical" href="/content/newsite/us/en.html"/>
</head>
Update 03/01/2023
I compared the error.log of localhost:4502 Author server to the one on the Dev Author server, and I found the following error on error.log of the Dev Author server where the ClientLibs are not working.
com.adobe.cq.wcm.core.components.internal.models.v1.ClientLibrariesImpl No categories detected. Please either specify the categories as a CSV string or a set of resource types for looking them up!
When I searched for this error it is reported in this open bug on AEM CORE Components
https://github.com/adobe/aem-core-wcm-components/issues/1808
