Server-side functions not working anymore in v3.2.0

Hi,

the following server-side functions worked OOTB in v3.0 and v3.1, but it’s not working anymore in v3.2.0.

return orient.getDatabase().countClass('V');

This function did not require any change in the java sandboxing in v3.0 nor in v3.1. It seems something broke in v3.2.0. Even doc.field() in dynamic hooks cannot be used anymore.

Here’s the error message from ODB Studio:

Error on parsing script at position #0: Error on execution of the script Script: c ------^ DB name="demodb" org.graalvm.polyglot.PolyglotException: TypeError: invokeMember (getDatabase) on com.orientechnologies.orient.core.command.script.OScriptOrientWrapper@76c52de7 failed due to: Unknown identifier: getDatabase TypeError: invokeMember (getDatabase) on com.orientechnologies.orient.core.command.script.OScriptOrientWrapper@76c52de7 failed due to: Unknown identifier: getDatabase

Do I need to perform some new configuration steps to enable server-side functions? If so could someone share a working solution?

Thanks in advance.
Rgds
Christian

Hi @cmichon

this is a known problem due to the addition of GraalVM support. There is a fix already (that still requires some minor adjustments), you can track it here [3.2.0] JS function invocation issues · Issue #9596 · orientechnologies/orientdb · GitHub
It will be released with v 3.2.1 very soon

Thanks

Luigi

Hi @luigidellaquila

I get it: it doesn’t work in GraalVM and even if turned off by configuration the code would not call for Nashorn.

We’re using JDK 8 only.

When is v3.2.1 scheduled?

Thx!

Hi @luigidellaquila

v3.2.1 released yesterday is still showing the same issue, same stack trace.

Rgds
Christian

Please ignore.

With the standard configuration, the server still tried to use GraalVM, whether available or not.

I managed with Windows and JDK8 (via configuration xml) to turn it off, and now it works as expected.

Sorry for the noise.

Hello everyone and @luigidellaquila ,

I tested with version 3.2.2 ( Debian 10, JDK8 ) but I still have the same problem regarding getDatabase or getGraphNoTx

Error on parsing script at position #0: Error on execution of the script\nScript: InsertNewLogin\n------^\r\n\tDB name=\"Totoum\"\norg.graalvm.polyglot.PolyglotException: TypeError: invokeMember (getDatabase) on com.orientechnologies.orient.core.command.script.OScriptOrientWrapper@4956c6ae failed due to: Unknown identifier: getDatabase\nTypeError: invokeMember (getDatabase) on com.orientechnologies.orient.core.command.script.OScriptOrientWrapper@4956c6ae failed due to: Unknown identifier: getDatabase"

I also put the value:

<entry value = "false" name = "OGlobalConfiguration.SCRIPT_POLYGLOT_USE_GRAAL" />

But in the logs here is what it returns to me:

Ignored storage configuration because not supported: OGlobalConfiguration.SCRIPT_POLYGLOT_USE_GRAAL = null [OClusterBasedStorageConfiguration]

Can you tell me what to do to fix the problem?

Best regards

P.S : My old post