Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.
SOLVED

Error during assembly of /apps

Avatar

Level 5

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.

 

function getPageUrlFromToken(data) {
        for(var pages of data.pageURL) {
            if(pages.rel === 'ADD.CARD') {
                console.log(pages);
                return pages.href;
            }
        }
    }

Any suggestion to fix this will be highly appreciated. Thank you!

1 Accepted Solution

Avatar

Correct answer by
Level 5

It start working after restarting the AEM instance without any change in code. 

Also, using "in" in-place of "of" in for loop, works.

View solution in original post

7 Replies

Avatar

Level 2

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.

 

Avatar

Level 5

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.

 

 

 

Avatar

Level 4

Hi @RashidJorvee 

 

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.

Avatar

Level 5

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.

Avatar

Administrator

@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!  



Kautuk Sahni

Avatar

Correct answer by
Level 5

It start working after restarting the AEM instance without any change in code. 

Also, using "in" in-place of "of" in for loop, works.