Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

Custom Iparsys - org.apache.sling.scripting.sightly.SightlyException

Avatar

Level 4

Hello All,

               We customized OOB iparsys component(/libs/wcm/foundation/components/iparsys) as per our business requirement. Copied the whole iparsys component from /libs to /apps folder, /apps/abc/components/content/site/custom-iparsys

We made our other custom changes to /libs/wcm/foundation/components/utils/ResourceUtils.js and /libs/wcm/foundation/components/utils/ParagraphSystem.js and placed them under /etc/designs/abc/xyz_clientlibs/js folder(not a clientlib).

And then modified, iparsys.js(/apps/abc/components/content/site/custom-iparsys/iparsys.js) and par.js(/apps/abc/components/content/site/custom-iparsys/par/par.js)
to use above custom JS files instead of original(/libs/wcm/foundation/components/utils/ResourceUtils.js and /libs/wcm/foundation/components/utils/ParagraphSystem.js) as shown below.

Iparsys.js:-

use(["/etc/designs/abc/xyz_clientlibs/js/ParagraphSystem.js"],function (ParagraphSystem) {

});

Par.js:-

use(["/etc/designs/abc/xyz_clientlibs/js/ResourceUtils.js","/etc/designs/abc/xyz_clientlibs/js/ParagraphSystem.js","/libs/sightly/js/3rd-party/q.js"], function (ResourceUtils,
ParagraphSystem, Q) {

});

The above customization is working as expected in AEM 6.0. But now we are migrating from AEM 6.0 to 6.3 and its breaking with below exception

03.04.2018 11:28:59.899 *ERROR* [127.0.0.1 [1522735139874] GET /content/asdf/test.html HTTP/1.1] com.day.cq.wcm.core.impl.WCMDeveloperModeFilter Error during include of SlingRequestPathInfo: path='/content/asdf/test/jcr:content/lhs', selectorString='null', extension='html', suffix='null' org.apache.sling.scripting.sightly.SightlyException: org.apache.sling.scripting.sightly.SightlyException: javax.script.ScriptException: Failure running script
/apps/abc/components/content/site/custom-iparsys/iparsys.js: Required script resource could not be located: /etc/designs/abc/xyz_clientlibs/js/ParagraphSystem.js. The caller is /apps/abc/components/content/site/custom-iparsys/iparsys.js

But if we copy the custom JS files(ResourceUtils.js  and ParagraphSystem.js) to folder /libs/wcm/foundation/components/utils_custom and update the path accordingly in iparsys.js and par.js as shown below, its working.

Iparsys.js:-

use(["/libs/wcm/foundation/components/utils_custom/ParagraphSystem.js"], function (ParagraphSystem) {

});

Par.js:-

use(["/libs/wcm/foundation/components/utils_custom/ResourceUtils.js", "/libs/wcm/foundation/components/utils_custom/ParagraphSystem.js", "/libs/sightly/js/3rd-party/q.js"],function (ResourceUtils, ParagraphSystem, Q) {

});

Could you please let us know, why iparsys.js and par.js is not able to call/include the custom JS files if they are present under /etc/designs/abc/xyz_clientlibs/js ?
How to resolve this issue in AEM 6.3?

Thanks in Advance

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

Hi,

I assume, that the javascript files are not executed by the browser, but rather executed by the server-side Javascript scripting engine. These scripting engine internally utilizes a JCR session to load all required parts. In AEM 6.0 most of services still used an admin session, while with AEM 6.3 most (all?) of these services have been migrated to service users with limited permissions. That could mean, that this problem is caused by missing permissions.

BUT: It can be only a permission problem if this JS code is executed on the server. And in that case it does not make sense at all to place this code in /etc/designs, but you should keep it below /apps. (Why have you moved it in the first place? It was below /libs anyway, so there's no reason to move it to /etc/design.)

kind regards,

Jörg

View solution in original post

4 Replies

Avatar

Level 10

Checked with our support team on this. The response is:

To my knowledge it has not been changed. Might be they need to recompile clientlibs.

Although in AEM 6.3 they should use Layout container rather then iparsys

You should look into using the Layout container as suggested by AEM support.

Avatar

Correct answer by
Employee Advisor

Hi,

I assume, that the javascript files are not executed by the browser, but rather executed by the server-side Javascript scripting engine. These scripting engine internally utilizes a JCR session to load all required parts. In AEM 6.0 most of services still used an admin session, while with AEM 6.3 most (all?) of these services have been migrated to service users with limited permissions. That could mean, that this problem is caused by missing permissions.

BUT: It can be only a permission problem if this JS code is executed on the server. And in that case it does not make sense at all to place this code in /etc/designs, but you should keep it below /apps. (Why have you moved it in the first place? It was below /libs anyway, so there's no reason to move it to /etc/design.)

kind regards,

Jörg

Avatar

Level 4

Thanks Scott and Jorg!

                                    It seems the issue is because of permissions. After moving the server side JS files to /apps folder its working.

Thanks for your help!

Avatar

Level 10

However - what do you want to accomplish with IParsy that you cannot do with layout components and even editable templates?