ActionDecl based function - "Function "XXX" not defined in script"

#1

When creating an ActionDecl based function to implement a series of calculations the following error was observed:

"ActionError"
**stack:**"Error: c3.love.exceptions.C3RuntimeException: c3.love.exceptions.C3RuntimeException: MetricEngine error : c3.love.exceptions.C3RuntimeException: Error c3.love.exceptions.C3RuntimeException: wrapped org.mozilla.javascript.JavaScriptException: Error: Function "cfer" not defined in script. (OilGasWell_cfer.js#2810)↵↵    at org.mozilla.javascript.gen.OilGasWell_cfer_js_709._c_anonymous_1↵    ...↵    at c3.engine.action.rhino.RhinoCompileUnit.execute (RhinoCompileUnit.java:82)↵↵  from OilGasWell_cfer.js, line 2810↵    2808  ↵    2809  ↵  > 2810  if (typeof cfer != 'function') throw new Error('Function "cf...↵    2811  global$.call$OilGasWell$cfer = function(obj, spec, metric) {↵    2812    return cfer.call(OilGasWell, obj, spec, metric);↵  from OilGasWell_cfer.js, line 1↵  > 1  (function(global$) {↵    2  var $Extendable$functions = (function() {↵    3  ↵	at  

This error was also observed for an older inherited function when the following was applied:
Let’s call the older function ZZZ, it ran with no errors upon calling ZZZ in an actionDecl metric. However, when we renamed from ZZZ to ZZZA the function was no longer recognised and the above error was once again observed.

Any ideas on what’s been wrongly applied/ how we can solve the issue?

0 Likes

#2

Are you sure you provisioned after changing the function name? Also both the metric and the function definition both need to be changed. This should not be happening if the types have been provisioned

0 Likes

#3

The error occurred post provision and after a c3ImportAll() was run as well. The name has also been changed in both files

0 Likes

#4

Something definitely doesn’t seem right in the process of the way this is provisioned. Since the error clearly says that:
function “cfer” does not exist

There is no solution to this since this is just bad metadata on the system. If you are sure that there is no human error in this process, please try to reproduce it on an independent tag and if it is consistently reproducible, please file a ticket with the services team with the reproducible case.

0 Likes

#5

One recommendation is to provision with -r (reset) flag. If this works please file a bug b/c provisioning without such a flag should have done the right thing. If it doesn’t work, see rohit’s comment above.

0 Likes

#6

Reproducible with the -r and with and without the -r in a new tag

  • Will get the appropriate ticket raised
0 Likes