Problem with node-red-contrib-actionflows since upgrade to 2.2.0

Since upgrade to 2.2.0, the "action in"-process isn't triggered anymore.

Log-Entry
RED.settings.functionGlobalContext.get is not a function
/app/node_modules/node-red-contrib-actionflows/actionflows/actionflows.js:270:51

What version are you using because GitHub shows line 270 to be blank:

Also RED.settings.functionGlobalContext.get ISN'T a function I don't believe?

To add to that - that line of code ...

... was present in the previous version: node-red-contrib-actionflows/actionflows/actionflows.js at 9034544b4e069fe31d0ffc36abaccebf2c5bbe89 ยท Steveorevo/node-red-contrib-actionflows ยท GitHub from Jan 2021.

@Roland You need to update node-red-contrib-actionflows

1 Like

domotics@1.0.0 /home/domotics/app
โ”œโ”€โ”€ agentkeepalive@4.2.0
โ”œโ”€โ”€ ansicolors@0.3.2
โ”œโ”€โ”€ node-red-contrib-actionflows@2.0.4
โ”œโ”€โ”€ node-red-contrib-advanced-ping@1.2.0
โ”œโ”€โ”€ node-red-contrib-ccu@3.4.2
โ”œโ”€โ”€ node-red-contrib-config@1.2.1
โ”œโ”€โ”€ node-red-contrib-cron-plus@1.5.6
โ”œโ”€โ”€ node-red-contrib-fritz@1.4.5
โ”œโ”€โ”€ node-red-contrib-fs-ops@1.6.0
โ”œโ”€โ”€ node-red-contrib-fs@1.4.1
โ”œโ”€โ”€ node-red-contrib-google-oauth-calendar@0.1.1
โ”œโ”€โ”€ node-red-contrib-influxdb@0.6.1
โ”œโ”€โ”€ node-red-contrib-moment@4.0.0
โ”œโ”€โ”€ node-red-contrib-mongodb4@1.2.3
โ”œโ”€โ”€ node-red-contrib-pjlink@1.0.4
โ”œโ”€โ”€ node-red-contrib-timerswitch@1.4.0
โ”œโ”€โ”€ node-red-contrib-twitter@1.1.3
โ”œโ”€โ”€ node-red-contrib-ui_list@0.1.5
โ”œโ”€โ”€ node-red-contrib-ui-contextmenu@2.0.1
โ”œโ”€โ”€ node-red-contrib-ui-multistate-switch@1.2.2
โ”œโ”€โ”€ node-red-contrib-ui-svg@2.3.1
โ”œโ”€โ”€ node-red-contrib-vacation-timer@2.2.8
โ”œโ”€โ”€ node-red-contrib-web-worldmap@2.26.1
โ”œโ”€โ”€ node-red-dashboard@3.1.5
โ”œโ”€โ”€ node-red-node-email@1.14.0
โ”œโ”€โ”€ node-red-node-feedparser@0.2.2
โ”œโ”€โ”€ node-red-node-markdown@0.1.4
โ”œโ”€โ”€ node-red-node-mysql@1.0.0
โ”œโ”€โ”€ node-red-node-openweathermap@0.5.1
โ”œโ”€โ”€ node-red-node-prowl@0.0.10
โ”œโ”€โ”€ node-red-node-tail@0.3.2
โ”œโ”€โ”€ node-red-node-ui-iframe@0.2.1
โ”œโ”€โ”€ node-red-node-ui-table@0.3.11
โ”œโ”€โ”€ node-red@2.1.6
โ”œโ”€โ”€ pm2@5.1.2
โ””โ”€โ”€ uuid@8.3.2

As you can see - I'am using "node-red-contrib-actionflows@2.0.4".
I send you some code-lines from my actionflow.js

   // Init mapping variables right away
    function map() {
      //var af = node.context().global.get('actionflows');
      var af = RED.settings.functionGlobalContext.get("actionflows");
      if (typeof af == "undefined") {
        af = new Object();

Thx for your help Regards Roland

At the moment, I don't understand. I clean npm cache and install it again but I get the old version. I copy the js-source from git and will test it.

2.0.4 does not work.

Latest version is 2.1.1

You are possibly installing in wrong place. Ensure you are in the correct .node-red directory. Look at your node-red startup log - what does User directory say?

Then do something like...

cd c:\users\stephen\.node-red
npm i node-red-contrib-actionflows@2.1.1

Then restart node-red.

1 Like

again thx for your help Steve, pleas help me. When I search in flows "node-red-contrib-actionflows (node) - Node-RED" I get 2.0.4 as current version.
When i try to install 2.1.1 I get

npm i node-red-contrib-actionflows@2.1.1
npm ERR! code ETARGET
npm ERR! notarget No matching version found for node-red-contrib-actionflows@2.1.1.

What went wrong, from where can I get your specified version. Do i use a wrong repository ?

Unfortunately, the author of this node hasn't published v2.1.1 - you will need to raise an issue on GitHub.

I you want to, you can manually install this version:

cd ~/.node-red
npm install Steveorevo/node-red-contrib-actionflows

That will install the version from GitHub. Couldn't say whether it will work though.

1 Like

I try this version without success. I switch (many) nodes from actionflows to "link call". I think this is the best way for the future. Again thx.
ps now all is fine with 2.2.0

As soon as I updated to 2.2.0 another package started to throw the same error

30 Jan 17:29:00 - [error] [chatbot-telegram-node:2cc35ee2a852bc9f] TypeError: RED.settings.functionGlobalContext.get is not a function

Have you raised an issue with the author of that node?

There appear to be several chatbot nodes so it isn't clear from the error msg which one you are using:

Library - Node-RED (nodered.org)

Not yet, this is the first result for searchig such error and I want to contrib specifying that it isn't related just to actionflows

It looks like someone already opened Chatbot broken with node-red 2.2.0? ยท Issue #520 ยท guidone/node-red-contrib-chatbot ยท GitHub

We made some internal changes in Node-RED with how global context is managed - and this error is a side-effect of that.

Using RED.settings.functionGlobalContext as way to access global context was never documented as a suitable way of doing it. The fact these nodes are broken because they took that approach, isn't ideal, but nor have we changed a published API.

We need to think about what to do here - should we revert our change to keep things working, or encourage these nodes to use proper APIs.

1 Like

Is it only the action node and chatbot node we know of Nick?

Is there an equivalent/usable published API we can request the Devs to use instead?

Also, we have the link call & other telegram nodes, is it not a case of pointing users to the alternatives?

1 Like

I really don't think you should revert because someone has used undocumented calls.

They've taken a risk- it hasn't worked #Life

4 Likes

I agree donโ€™t revert. and if we do โ€œfixโ€ it do we then have to add it to the api and maintain it ? Or immediately deprecate it again. Messy

2 Likes

I think what we need is insight as to why this API was being used in this way.

Nodes have full access to global context - they have no need to use this API. Code outside of a node doesn't have a way to access context - so this would be one way to get around that.

Need to do some digging into those nodes to see how/why they use that API.

My flows are broken as well . We are using node-red-contrib-actionflows extensively.

The provide an excellent mechanism to have a dynamically pluggable/extensible flows.
We have upgraded only 1 environment to 2.2 for test. But its starting to raise concerns if we need to change now all our flows (close to 70-80 flows) to something not as dynamic.

The main challenge would be to be able to find something as dynamic and useful.

Appreciate if this change can be made in some way backward compatible.

Looking at the code in actionflows, there are just 2 references and it appears to me as though it is just an odd way of calling get/set.

I can see that nobody has yet raised an issue against that repo which is the first step. It looks like the fix is a very simple change of just 2 lines so it wouldn't be hard to fix it and issue a PR.