acs-aem-commons icon indicating copy to clipboard operation
acs-aem-commons copied to clipboard

ACS Commons Versioned Clientlibs not working for JS files

Open jchercoles-vass opened this issue 2 years ago • 3 comments

Required Information

  • [x] AEM Version, including Service Packs, Cumulative Fix Packs, etc: AEM 6.5.10 + SP10
  • [x] ACS AEM Commons Version: 4.4.2
  • [ ] Reproducible on Latest? haven't tested

Expected Behavior

JS version should be generated for the versioning of AEM Client lib using the acs-aem-commons package

Actual Behavior

Our clientlib JS versioning has stopped working after upgrading to AEM SP10 on 6.5. Not sure if the SP10 package is the issue, but should be, since the issue was detected after this package installation.

Versioning was working perfectly, but now only CSS files are being versioning

Our script tags are rendered as follow:

<script src="/etc.clientlibs/<project-name>/clientlibs/clientlib-components/<clientlib-name>.min.js"></script>

We enabled debug logs for com.adobe.acs.commons.rewriter.impl.VersionedClientlibsTransformerFactory and traces are as follow:

com.adobe.acs.commons.rewriter.impl.VersionedClientlibsTransformerFactory Rewriting to: /etc.clientlibs/<project-name>/clientlibs/clientlib-components/<clientlib-name>.min.<version-number>.css

This only applies to css files. We can't see any other logs besides that one (one for each css file in the page)

After futher checking in the ACS Commons code in file VersionedClientlibsTransformerFactory.java, seems like our clientlib is not passing the check for SaxElementUtils.isJavaScript(elementName, attrs), since if this condition is true, we could see futher logs about the problem. At least one of these:

  • log.debug("Rewriting to: {}", versionedPath);
  • log.debug("Versioned Path could not be created properly");

This issue happens only in publishers, but not author. The config file is located at: /apps/<project-name>/config/rewriter/default with this xml:

<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
          jcr:primaryType="nt:unstructured"
          contentTypes="[text/html]"
          enabled="{Boolean}true"
          generatorType="htmlparser"
          order="-1"
          serializerType="htmlwriter"
          transformerTypes="[linkchecker,mobile,mobiledebug,contentsync,versioned-clientlibs]">
	<transformer-mobile
			jcr:primaryType="nt:unstructured"
			component-optional="{Boolean}true"/>
	<transformer-mobiledebug
			jcr:primaryType="nt:unstructured"
			component-optional="{Boolean}true"/>
	<transformer-contentsync
			jcr:primaryType="nt:unstructured"
			component-optional="{Boolean}true"/>
</jcr:root>

We already restarted the publisher instances but it had no effect

jchercoles-vass avatar Mar 07 '22 15:03 jchercoles-vass

Hello,

We would appreciate an update on this issue, even if it is to say it is not going to be done, in order to stop following the issue if that is going to be the case.

Thank you!

julio-ros-vass avatar Oct 28 '22 10:10 julio-ros-vass

I'm noticing that if I put the versioned clientlib rewriter config under apps/acs-commons/config, it does work... I'd love to have this live under our existing /apps/app-name/ though

mschmid42 avatar Jun 06 '23 17:06 mschmid42