Setting inject node interval from env variable (in subflow)


Strange one. I had been using a trigger for some checking logic off a inject node used in a subflow. I had been configuring the interval of this inject node via an environment variable. All works well when using seconds. If i change interval to minutes i get an error and cannot deploy??

syntax for interval: ${env-var}


Can you post a mini flow showing this to make it easier for us to test please.

of course...

[{"id":"f11caa36.6bdd08","type":"subflow","name":"Subflow 1","info":"","category":"","in":[],"out":[{"x":700,"y":210,"wires":[{"id":"e7da42f1.95859","port":0},{"id":"390962d8.89312e","port":0}]}],"env":[{"name":"test","type":"num","value":"6"}],"color":"#DDAA99"},{"id":"e7da42f1.95859","type":"inject","z":"f11caa36.6bdd08","name":"seconds","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"${test}","crontab":"","once":false,"onceDelay":0.1,"topic":"seconds","payload":"","payloadType":"date","x":340,"y":210,"wires":[[]]},{"id":"390962d8.89312e","type":"inject","z":"f11caa36.6bdd08","name":"minutes","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"NaN","crontab":"","once":false,"onceDelay":0.1,"topic":"minutes","payload":"","payloadType":"date","x":340,"y":290,"wires":[[]]},{"id":"89634b56.6586e8","type":"subflow:f11caa36.6bdd08","z":"eaaa5e2f.e4d8c","name":"","x":440,"y":240,"wires":[["ca5db143.5ae89"]]},{"id":"ca5db143.5ae89","type":"debug","z":"eaaa5e2f.e4d8c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":600,"y":250,"wires":[]}]

Yes, I see what you mean, it won't even let the inject node be configured with a variable and minutes.
In fact it is nothing to do with subflows, it won't let you configure an inject like this in the main flow either


It is ok if you specify seconds instead of minutes.

I suggest submitting a bug report for this so it will get looked at at some point. Issues · node-red/node-red · GitHub

It's not a bug. Not all fields can accept environment variables. Any that are simple text can - but any that are calculated for display cannot be. The other typical one is the rules for change or switch nodes etc. In this case there is only one variable (the number in seconds). When it comes to display if it's a whole number of minutes we change it to minutes and likewise hours... - so if you put in 60 secs - save it - then re-edit - it will display as one minute. So no it's not a bug - just use seconds.

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.