Server side JS not working

5.4.5.1
Hi all

Is there any reason server side JS won’t run?
Even something simple as
<script runat="server"> print('<h1>%asset_name%</h1>'); </script>
won’t show anything.
Is there a system config or something I need to do?

Thanks

At the moment the best way to check if Matrix can execute JS correctly is to create a REST Resource asset (might still be called “REST Resource JavaScript” in 5.4.5.1 I’m not sure) and check whether either of the engines can be chosen without a warning showing.

E.g warning showing for SpiderMonkey:

Clean V8JS install:

image

These are the same engines SSJS will try to use.

Thanks

We are using those in the site, and a fresh one did not bring back any errors.
So seems that JS can execute?

As long as the REST Resource doesn’t show a warning when selecting one of the JS engines, the SSJS example you gave should execute ok in a standard page.

Perhaps check Matrix’s error.log when rendering the front end page?

Hi

Thanks for that…looks like I had another ss script that was erroring and blocking this one :slight_smile: