When I am deploying the code after adding a custom component, the front-end code is not loading on the site. When I try to rebuild the library Using AEM console, I am seeing these error "Error while reading cached library: javax.jcr.RepositoryException: Error during assembly of /etc/designs/br/scripts/all.js" also "java.io.IOException: Error while reading cached library: javax.jcr.RepositoryException: Error during assembly of /apps/brs/components/content/componentName/clientlib.js".
But when I am changing the JS processor from YUI to GCC it start working. And when I remove a function from a JS code file, YUI also work and front-end code script load on the code. Below is the JS function that causing issue.
Any suggestion to fix this will be highly appreciated. Thank you!
Solved! Go to Solution.
Views
Replies
Total Likes
It start working after restarting the AEM instance without any change in code.
Also, using "in" in-place of "of" in for loop, works.
If you need to use YUI, try simplifying your JavaScript code. The issue might be related to the for...of loop. You can replace it with a more traditional approach:
function getPageUrlFromToken(data) {
for (var i = 0; i < data.pageURL.length; i++) {
var pages = data.pageURL[i];
if (pages.rel === 'ADD.CARD') {
console.log(pages);
return pages.href;
}
}
}
Check the full stack trace and logs for any additional clues. There might be more information on why the YUI compressor is failing with your specific code.
Let me try with different way of for loop and test. Thank you for suggestion.
Yes, this way it works. Also, replacing of with in inside for works.
getPageUrlFromToken(data) seems to be causing issues with the YUI processor. Try removing this function or commenting it out to see if the client libraries assemble correctly, If switching the JS processor from YUI to GCC resolves the issue, it might be a compatibility issue between your code and YUI. You can explore using GCC for your client libraries.
A corrupted clientlib cache can sometimes lead to assembly errors. Try clearing the clientlib cache and rebuilding the libraries.
After removing that function build is successful as I mentioned earlier.
I tried clearing the cache and rebuild the library from console, but still seeing the issue.
@RashidJorvee Did you find the suggestion 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
It start working after restarting the AEM instance without any change in code.
Also, using "in" in-place of "of" in for loop, works.
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies