Public
Occasional Advisor

Component parse failure when using @liaAddScript

Hi,

 

I am getting the following error thrown when submitting a plugin to staging via the SDK....

 

Failure Code: COMPONENT_PARSE_FAILURE
Failure Rule: CUSTOM_RULE
Failure Message: A component file in the plugin has a possible issue.
Failure Details: Detailed error is: No object of type lithium.web.javascript.tapestry.services.LithiumJavaScriptSupport is available from the Environment..

 

This is happening for every component that uses the @liaAddScript directive.

 

Does anybody have any idea what could be causing this?

 

Any help is much appreciated!

 

Thanks

James

 

EDIT: Sorry, here is an example code snippet that is failing

 

<@liaAddScript>
;(function($){
setTimeout(function() {

jQuery('.lia-category-community-management').after('<li class="board-dropdown-item community-admin-link"><a href="/t5/bizapps/bizappspage/tab/community%3Aadmin" id="communityAdmin" class="lia-link-navigation lia-component-admin-widget-admin">Community Admin</a></li><li class="board-dropdown-item plugin-editor-link"><a href="/t5/bizapps/bizappspage/tab/community%3Astudio" id="lithiumStudio" class="lia-link-navigation lia-component-lithiumstudio-action-lithium-studio">Studio</a></li>');
},1000);
})(LITHIUM.jQuery);
</@liaAddScript>

 

7 Replies 7
Honored Contributor

@james_whiteley

 

This might be a long shot but the namespace for JQuery is already mapped to $ so you could try modifying the line beginning jQuery as follows:

 

<@liaAddScript>
;(function($){
setTimeout(function() {

$('.lia-category-community-management').after('<li class="board-dropdown-item community-admin-link"><a href="/t5/bizapps/bizappspage/tab/community%3Aadmin" id="communityAdmin" class="lia-link-navigation lia-component-admin-widget-admin">Community Admin</a></li><li class="board-dropdown-item plugin-editor-link"><a href="/t5/bizapps/bizappspage/tab/community%3Astudio" id="lithiumStudio" class="lia-link-navigation lia-component-lithiumstudio-action-lithium-studio">Studio</a></li>');
},1000);
})(LITHIUM.jQuery);
</@liaAddScript>

Let us know if this works.

Robert


Click the Kudos button below if you find my posts helpful. If I've answered your query please click the Mark Solution button to help others find the same answer.

Hi @RobertT,

 

Thanks for your reply!

 

It fails even if I take that line out unfortunately. There's 9 components in total that contain a @liaAddScript directive and each of them are failing with the same error.

 

Thanks for your help

James

@james_whiteley,

 

There is one more thing you can try, it involves modifying the server.conf.json file in the root of your SDK folder to change the following lines or add them if they are missing.

 

"strictMode": false,
"skipTemplateValidation": true

This needs to be added before the closing } in the file. What you're doing is effectively turning off validation on files before uploading them to studio. 

 

 

 

Robert


Click the Kudos button below if you find my posts helpful. If I've answered your query please click the Mark Solution button to help others find the same answer.

Hi @RobertT,

 

Thanks again for your reply.

 

It will still fail validation on production though, I would have thought.

 

James

@james_whiteley, it shouldn't fail if you know the code has run before.

 

What you may want to do is create the component in Studio first and test it with the same code, Studio will always override the SDK, but if you create the same component in Studio and paste in the code to test it should confirm if there is a problem with validation.

Robert


Click the Kudos button below if you find my posts helpful. If I've answered your query please click the Mark Solution button to help others find the same answer.

Hi @RobertT,

 

I've managed to get it working and live on production. Thanks very much for your help, I will accept your suggestion to modify the server.conf.json as the solution.

 

James

Epic, 

 

Glad it's sorted for you 🙂

Robert


Click the Kudos button below if you find my posts helpful. If I've answered your query please click the Mark Solution button to help others find the same answer.

Welcome to the Technology board!

Curious about our platform? Looking to connect on social technology? You've come to the right place!

Are you a Khoros customer? For direct assistance from our Support team, please visit the Support Forum.