|
本帖最后由 dscao 于 2022-2-1 21:21 编辑
昨天升级了add on中的Node-RED 10.4.0 ,也就是node-red 2.2.0,结果之前的快递查询和PVE爱快等用到action节点的全部不工作。每次部署都会导致node-red重启一下,日志中有如下报错。
RED.settings.functionGlobalContext.get is not a function
/node_modules/node-red-contrib-actionflows/actionflows/actionflows.js:270:51
搜索了一下,原来是节点使用了未发布的api,新版给去掉了。
开发者在考虑是否恢复还是应该让节点作者升级。
https://discourse.nodered.org/t/problem-with-node-red-contrib-actionflows-since-upgrade-to-2-2-0/57368/13
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.
回复中也提到最好使用link call节点代替,才是最好的方案。
https://nodered.org/blog/2021/10/21/version-2-1-released#new-link-call-node
New Link Call node
The new Link Call node can be used alongside the Link-In/Out nodes to create subroutine-like flows.
If you have a flow that starts with a Link-In node and ends with a Link-Out node that has been put into its new ‘return’ mode (giving the node a different icon), the Link Call node can be used to pass that flow a message and the result is passed back to the calling node.
As an alternative to using subflows, this is great for creating little utility flows that you want to reuse in multiple places.
花了约大半小时将所有的action节点全部换成link call后,终于正常运行。
|
|