Hi,
We need to run some statistical calculations in a Service and require a specific external JavaScript library (jStat). But when running the Service we receive the error “FunctionEvalError: jStat is not defined”.
The external library is loaded using the custom header tag section in Environment settings (see screen below). We’re not receiving any errors when running/testing the calculations using the jStat library in an app.
I’m only able to find documentation on how to load external libraries to be used in Apps. What is the recommended way to set up an external library so a Service can reach it?
Apps and Services run respectively on client and server. The external scripts added to Environment Config are only available on the client. We currently do not support external javascript libraries in Services. This requires another level of security measures, since it’s executed on the server.
However, I’ll register a challenge on that, since it would be very handy in some circumstances!
What is the status on this challenge? And how might we overcome this challenge ourselves? It is crucial for us to use libraries in Services. @ErikAKSkallevold@kristian
Hi @SinanMaric
Not sure if Appfarm has completed this challenge yet but a possible workaround is to add the library’s content directly into the function where you want to use it. It’s not a pretty solution but it does work (although you get a lot of warnings and errors in the code editor)
In the screenshots below you can see that I’ve added the library’s content before running the final function calls where we use it.