Written by

~~ retired but not tired ~~
Article Robert Cemper · Aug 3 1m read

WARNING: Bug in IRIS Native API

Reviewing my published packages, I identified a nasty bug in IRIS Native API

  • There is a method in  %Net.DB.Iris named function ()
  • It's equivalent to  ObjectScript $$label^routine(param) 
  • It used to work fine 2 years ago, when I published my command-line-extension packages
  • Now it is broken since at least 1 year and throws <PROTECT>
  • I identified it for ObjecScript, Java, Python, Node.js
  • It is reported as WRC# 1002589
  • For all 4 cases, I also verified a workaround
    • Instead of calling an ObjectScript Function you call a Classmethod
    • It's by %Net.DB.Iris ClassMethodValue(...)
    • And you have to wrap your ObjectScript Function into some Class 
    • Might look simple, but quite some effort related to IPM versions and other

I wish you were not infected by that surprise.
 

Comments

I while back InterSystems added some new resources to add more security for Native API
You may need to add them 

0
Robert Cemper  Aug 3 to Dmitry Maslennikov

quite an interesting hidden feature.

Though testing with _SYSTEM/SYS and %All, this had no visible impact
It is exactly 1 method that breaks in all 4 Nativ packages 
And with %All the rest is available anyhow and working fine.
 

BUT eventually %All is not All enough

0
Vitaliy Serdtsev  Aug 4 to Robert Cemper

Here explained to us that this is not a bug, but a feature: <PROTECT> *Function not allowed in IRIS Native python

Starting from 2024.1 IRIS Native disallows routine invocations. Please use class methods instead.

For reference, these changes can be identified as DP-422635 and DP-424156.

PS: and yes, additional roles and resources like %Native_*/%All etc. no eliminate the <PROTECT> error. Checked on version 2025.2.CE
0
Robert Cemper  Aug 4 to Vitaliy Serdtsev

It might be great to remove the related refences also
from official documentation
Py
https://docs.intersystems.com/components/csp/docbook/Python-Native/v1.0.0/irisnative.iris.html#irisnative.iris.function

Nodes.js
https://docs.intersystems.com/components/csp/docbook/NodeJS-Native/v2019.2/external-_intersystems-iris-native_.Iris.html

Java
https://docs.intersystems.com/iris20201/csp/docbook/DocBook.UI.Page.cls?KEY=BJAVNAT_call#BJAVNAT_call_function

.NET
https://docs.intersystems.com/iris20201/csp/docbook/DocBook.UI.Page.cls?KEY=BNETNAT_call#BNETNAT_call_function

Also Class reference for 2025.1
https://docs.intersystems.com/iris20251/csp/documatic/%25CSP.Documatic.cls?LIBRARY=%25SYS&CLASSNAME=%25Net.DB.Iris#Function

like this:
Calls a function (label^routine), passing zero or more arguments and returning the function's return value. Trailing arguments may be omitted, causing default values to be used for those arguments.

This method throws an exception when an error condition is encountered.

routineName

input

The name of the routine that implements the function to be called.

functionName

input

The name of the function to be invoked.

args

input...

The arguments to be passed to the method.

 

return

The value returned by the functionName function.


  • Such a misleading documentation roughly 1.5 years behind reality is not so impressive
  • It took days to find this out.  😖
0
Vitaliy Serdtsev  Aug 4 to Robert Cemper

I completely agree with you.👍

I hope someone from InterSystems will pay attention to your post.

PS: and in addition, it would also be nice to solve the issue with %FromOref(): either the code or the documentation needs to be fixed. On version 2025.2.CE it still doesn't work.

0
Robert Cemper  Aug 4 to Irène Mykhailova

Suggested Idea:Keep documentation in sync with reality  .. ?  🤭

0
Ben Spead  Aug 4 to Nick Petrocelli

I completely agree!  Doc offers a direct channel to them for feedback, and they are very responsive to that.

Every documentation page has a Feedback button on the right, which will capture the page from which the feedback originates, making it even faster for the Docs team to know where a tweak is needed:

0
Robert Cemper  Aug 4 to Ben Spead

AH,  That was meant by feedback
Which is easy now, as it wasn't a bug but an explicit feature

0
Robert Cemper  Aug 4 to Ben Spead

The feedback button is not available for Python and for Node.js.
These were my 1st broken examples
 

0
Ben Spead  Aug 4 to Robert Cemper

got it -  I reached out to the Docs team to better understand why the button isn't there

0