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
.png)
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
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.PS: and yes, additional roles and resources like %Native_*/%All etc. no eliminate the <PROTECT> error. Checked on version 2025.2.CEFor reference, these changes can be identified as DP-422635 and DP-424156.
Thank you for the explanation. @Vitaliy Serdtsev 🙂👍
This matches my investigations
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
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. 😖
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.
Hi @Vitaliy Serdtsev, could you please add this issue as an idea to the Ideas Portal?
I think this should be addressed to the WRC rather than the Ideas Portal. Also, @Robert Cemper has already registered WRC #1002589 and @Evgeny Shvarov most likely has too.
Suggested Idea:Keep documentation in sync with reality .. ? 🤭
I would recommend reporting this on the docs feedback page: https://docs.intersystems.com/irislatest/csp/docbook/Doc.Feedback.cls
In my experience they are very responsive to this kind of feedback
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:.png)
AH, That was meant by feedback
Which is easy now, as it wasn't a bug but an explicit feature
The feedback button is not available for Python and for Node.js.
These were my 1st broken examples
got it - I reached out to the Docs team to better understand why the button isn't there