Node-REDA visual wiring tool for the Internet of Thingshttps://nodered.org Version 4.0 released <p>Node-RED 4.0 is now available to <a href="https://npmjs.org/package/node-red">install</a>. If upgrading, please read the <a href="http://nodered.org/docs/getting-started/upgrading.html">upgrade instructions</a>.</p> <p>We’ve highlighted some of the main highlights of the release below. There have also been a large number of community contributions ranging from bug fixes, features, documentation and translations. We wouldn’t be able to do what we do without these contributions - a big thank you to everyone involved.</p> <p>The <a href="https://github.com/node-red/node-red/releases/tag/4.0.0">Change Log</a> has the full list of changes in this release.</p> <hr /> <ul> <li><a href="#nodejs-18-or-later">Node.js 18 or later</a></li> <li><a href="#editor-updates">Editor Updates</a> <ul> <li><a href="#auto-complete-for-flowglobal-and-env-inputs">Auto-complete for <code class="language-plaintext highlighter-rouge">flow</code>/<code class="language-plaintext highlighter-rouge">global</code> and <code class="language-plaintext highlighter-rouge">env</code> inputs</a></li> <li><a href="#customising-config-nodes-in-subflows">Customising config nodes in Subflows</a></li> <li><a href="#timestamp-formatting">Timestamp formatting</a></li> <li><a href="#multiplayer-mode">Multiplayer Mode</a></li> <li><a href="#better-background-deploy-handling">Better background deploy handling</a></li> <li><a href="#improved-diff-view-for-moved-nodes">Improved Diff view for moved nodes</a></li> <li><a href="#better-feedback-for-read-only-users">Better feedback for read-only users</a></li> <li><a href="#new-config-node-selection-ui">New Config Node selection UI</a></li> <li><a href="#other-updates">Other updates</a></li> </ul> </li> <li><a href="#runtime">Runtime</a> <ul> <li><a href="#faster-deploys-for-large-flows">Faster deploys for <em>large</em> flows</a></li> <li><a href="#updated-jsonata">Updated JSONata</a></li> <li><a href="#other-updates-1">Other updates</a></li> </ul> </li> <li><a href="#node-updates">Node Updates</a> <ul> <li><a href="#a-better-csv-node">A better CSV node</a></li> <li><a href="#updated-proxy-handling">Updated Proxy Handling</a></li> <li><a href="#other-updates-2">Other updates</a></li> </ul> </li> <li><a href="#full-changelog">Full Changelog</a></li> <li><a href="#community">Community</a></li> </ul> <hr /> <h2 id="nodejs-18-or-later">Node.js 18 or later</h2> <p>Node-RED 4.0 requires at least Node.js 18. At the time of release, we recommend using Node 20 as the active LTS release that will continue receiving updates until April 2026.</p> <h2 id="editor-updates">Editor Updates</h2> <h3 id="auto-complete-for-flowglobal-and-env-inputs">Auto-complete for <code class="language-plaintext highlighter-rouge">flow</code>/<code class="language-plaintext highlighter-rouge">global</code> and <code class="language-plaintext highlighter-rouge">env</code> inputs</h3> <p>Node-RED already has simple auto-complete on <code class="language-plaintext highlighter-rouge">msg</code> fields in the editor. We’ve now extended that to also work with <code class="language-plaintext highlighter-rouge">flow</code>/<code class="language-plaintext highlighter-rouge">global</code> context inputs as well as the <code class="language-plaintext highlighter-rouge">env</code> type for accessing environment variables.</p> <p><img src="/blog/content/images/2024/06/auto-complete.png" alt="" /></p> <p>This makes it so much easier to work with these types of properties - being sure you’re using something that exists rather than having to switch between different views in the editor to get the names right.</p> <p>In the case of env vars, it also shows you where the value was set - useful when you have nested groups and subflows which might be overriding a particular value.</p> <h3 id="customising-config-nodes-in-subflows">Customising config nodes in Subflows</h3> <p>This one needs a bit of explaining. Subflows are a way Node-RED lets you create a flow and add multiple reusable instances of it within your flows. For example, a subflow may connect to an MQTT broker and do some standard processing on the messages it received before sending them on. The Subflow can then expose a set of properties that can be customised for each instance. In our example, that could be the topic the MQTT node subscribes to.</p> <p>However, in that example, the MQTT node’s broker configuration would be locked to the same broker config node in every instance - and that’s something we’re solving in Node-RED 4.0.</p> <p>We’re making it possible to expose the choice of a configuration node in the Subflow properties - so each instance can be customised even further.</p> <p><img src="/blog/content/images/2024/06/subflow-config.png" alt="" /></p> <p>Another common use for this will be with Node-RED Dashboard - which uses config nodes to set the location of a widget. With Node-RED today, you cannot really use dashboard nodes inside subflows as you end up with multiple copies of the widgets all packed into the same group. With this update, you’ll be able to configure the subflow instance with exactly what dashboard group to place its contents into.</p> <h3 id="timestamp-formatting">Timestamp formatting</h3> <p>The Inject node has provided the ability to inject a timestamp since the very early days of Node-RED. The value it actually sets is the number of milliseconds since epoch (aka January 1st, 1970). If you’re used to working with JavaScript, then this is a perfectly normal way to pass times around. However, it isn’t always what is needed and flows end up using a Function node to reformat it in some way.</p> <p>With 4.0 we’ve added options to pick what format the timestamp is generated in at the start. Now, formatting times and dates can be a big can of worms of options. So, for this initial release, we’ve kept it simple by offering three options:</p> <p><img src="/blog/content/images/2024/06/timestamp-formats.png" alt="" /></p> <ul> <li><em>milliseconds since epoch</em> - the existing option, just more explicitly labelled for what it is</li> <li><em>YYYY-MM-DDTHH:mm:ss.sssZ</em> - also known as ISO 8601</li> <li><em>JavaScript Date Object</em> - the standard Date object</li> </ul> <p>There is scope to allow custom format strings to be set in the node - but we’ll see what the feedback is on these new options first.</p> <h3 id="multiplayer-mode">Multiplayer Mode</h3> <p>We’ve made a number of changes to improve the user experience when multiple people have the editor open at the same time.</p> <p>When enabled via the settings file, the new Multiplayer Mode lets you see when other users have the editor open and where they are - which tab they have open and whether they are editing a node.</p> <p><img src="/blog/content/images/2024/06/multiplayer.png" alt="" /></p> <p>It’s a small step forward towards a longer-term goal of having a live view of the changes other users are making.</p> <p>This new mode is not enabled by default. To turn it on, you need to set <code class="language-plaintext highlighter-rouge">editorTheme.multiplayer.enabled</code> property to <code class="language-plaintext highlighter-rouge">true</code> in your settings file. We’ve added a placeholder in the default settings file, but for an existing install, you’ll need to add it yourself. You can see how/what it should look like <a href="https://github.com/node-red/node-red/blob/3075b82792be6f9668376e66fe6cf3fc137902ff/packages/node_modules/node-red/settings.js#L440-L443">here</a>.</p> <h3 id="better-background-deploy-handling">Better background deploy handling</h3> <p>In the same theme as the new Multiplayer Mode, we’ve also made some improvements to the existing ‘background deploy’ handling in the editor. This is where someone deploys new flows whilst you are busy working in the editor.</p> <p>Previously, you would get a notification that you couldn’t ignore and would have to interrupt what you were doing to deal with. If your colleague was being particularly productive and deploying frequently, you’d get a new interruption every time.</p> <p>With this release, we’ve made the notification less intrusive. It’s no longer modal, so you can carry on what you were doing without having to take any action. We’ve made it slim line so it doesn’t get in the way, and it will self-close after a short period. As with similar runtime notifications, we now also show a warning icon in the header if there has been a background deploy - as it <em>will</em> need dealing with eventually - clicking on that icon shows the notification so you can take action when you choose to.</p> <p><img src="/blog/content/images/2024/06/background-deploy.png" alt="" /></p> <h3 id="improved-diff-view-for-moved-nodes">Improved Diff view for moved nodes</h3> <p>When reviewing changes in the flows, either as a result of a background deploy, or as part of the Projects feature, we now highlight nodes that have only been moved separately to those that have had configuration changes.</p> <p>When faced with a long list of changes, this will make it easier to spot changes that you care about.</p> <p><img src="/blog/content/images/2024/06/diff-view.png" alt="" /></p> <h3 id="better-feedback-for-read-only-users">Better feedback for read-only users</h3> <p>Previously if a user had read-only access to the editor, they could make changes and click the deploy button - only to be told at that point they cannot make changes.</p> <p>With this release, the Deploy button now shows a lock icon if the current user doesn’t have permission to deploy changes. They can still make changes in the workspace, but the deploy button won’t become enabled.</p> <p><img src="/blog/content/images/2024/06/locked-deploy.png" alt="" /></p> <h3 id="new-config-node-selection-ui">New Config Node selection UI</h3> <p>We’ve updated the UI around config node selection to simplify the task of adding a new config node.</p> <p>Feedback from new users showed some confusion on how to add a <em>second</em> config node when there was one already selected in the list. There is now a dedicated add button alongside the selection of existing nodes</p> <p><img src="/blog/content/images/2024/06/add-config-node.png" alt="" /></p> <h3 id="other-updates">Other updates</h3> <ul> <li>The Palette Manager now lists plugins you have installed alongside nodes.</li> <li>The Palette sidebar now remembers how you have expanded or collapsed the different categories</li> </ul> <h2 id="runtime">Runtime</h2> <h3 id="faster-deploys-for-large-flows">Faster deploys for <em>large</em> flows</h3> <p>We’ve swapped the library we use to clone flow configurations in the runtime. The new library is faster and uses less memory.</p> <p>The gains are less noticeable in ‘typical’ flows, but for those of you with <em>large</em> flows, there should be an improvement.</p> <p>In my testing, a config with a few hundred tabs with a few hundred nodes on each, plus some subflows went from 8 seconds to deploy down to just over 1 second.</p> <h3 id="updated-jsonata">Updated JSONata</h3> <p>The JSONata library is used to provide the <code class="language-plaintext highlighter-rouge">expression</code> types in Node-RED - a really powerful way of working with JSON objects. With this release we’ve updated to the new major release of JSONata that comes with a bunch of performance improvements.</p> <p>But it also comes with a breaking change with how it gets invoked under the covers. We prepared for this in 3.1 by adding a large warning to the log if we ever spotted a node accessing it incorrectly. With this release, that warning becomes an error.</p> <p>Given we didn’t hear a lot of complaints in the 3.1 release about this, either the warning went unnoticed, or it isn’t a wide-spread issue. However, this will be something to keep an eye on as you upgrade.</p> <h3 id="other-updates-1">Other updates</h3> <ul> <li>The following configuration options have been added to the default settings file: <ul> <li><code class="language-plaintext highlighter-rouge">httpAdminCookieOptions</code> can be used to customise the options set on cookies as part of the authentication system.</li> <li><code class="language-plaintext highlighter-rouge">httpStaticCors</code> can be used to set custom cross-origin resource sharing rules for the content served up via the <code class="language-plaintext highlighter-rouge">httpStatic</code> option</li> </ul> </li> <li><code class="language-plaintext highlighter-rouge">node-red --version</code> now reports the node-red, node.js and os information without starting Node-RED.</li> </ul> <h2 id="node-updates">Node Updates</h2> <h3 id="a-better-csv-node">A better CSV node</h3> <p>The CSV node has had a big overhaul to make it more standards compliant. It turns out CSV has a whole bunch of tricky edge cases that most users don’t hit - but if you did hit them you would be stuck.</p> <p>The new node follows the <a href="https://www.ietf.org/rfc/rfc4180.txt">RFC4180</a> standard and is also faster - wins all around.</p> <p>Existing flows using the CSV node will stay in ‘legacy’ mode until they are modified to use the new parser.</p> <h3 id="updated-proxy-handling">Updated Proxy Handling</h3> <p>The HTTP Request node’s handling of proxies has been updated to address a number of issues and to bring better support for the various standard environment variables used to configure proxies.</p> <p>Details are in the <a href="https://github.com/node-red/node-red/issues/3904">original issue</a> and the <a href="https://github.com/node-red/node-red/pull/4616">pull request</a> that fixed it.</p> <h3 id="other-updates-2">Other updates</h3> <ul> <li>TCP node - when resetting, if no payload, stay disconnected @dceejay</li> <li>HTML node: add option for collecting attributes and content (<a href="https://github.com/node-red/node-red/pull/4513">#4513</a>)</li> <li>let split node specify property to split on, and join auto join correctly (<a href="https://github.com/node-red/node-red/pull/4386">#4386</a>)</li> <li>Fix change node to return boolean if asked (<a href="https://github.com/node-red/node-red/pull/4525">#4525</a>)</li> <li>Let msg.reset reset Tcp request node connection when in stay connected mode (<a href="https://github.com/node-red/node-red/pull/4406">#4406</a>)</li> <li>Let debug node status msg length be settable via settings (<a href="https://github.com/node-red/node-red/pull/4402">#4402</a>)</li> <li>Feat: Add ability to set headers for WebSocket client (<a href="https://github.com/node-red/node-red/pull/4436">#4436</a>)</li> </ul> <h2 id="full-changelog">Full Changelog</h2> <p>The full set of changes in this release can be found in the <a href="https://github.com/node-red/node-red/releases/tag/4.0.0">changelog</a></p> <p>Thank you to everyone who contributed to this release - we wouldn’t be able to do it without you!</p> <h2 id="community">Community</h2> <p>As an open-source project we are reliant on the contribution of the community. We have a strong and vibrant user community, well demonstrated by the activity on the <a href="https://discourse.nodered.org">forums</a>. It’s great to see the support the community provides each other.</p> <p>If you’re interested in contributing to Node-RED, now is a good time to come over and chat with us in either the <a href="https://discourse.nodered.org">forum</a> or <a href="https://nodered.org/slack">slack</a>.</p> Thu, 20 Jun 2024 00:00:00 +0000 https://nodered.org/blog/2024/06/20/version-4-0-released https://nodered.org/blog/2024/06/20/version-4-0-released Version 3.1 released <p>Node-RED 3.1 is now available to <a href="https://npmjs.org/package/node-red">install</a>. If upgrading, please read the <a href="http://nodered.org/docs/getting-started/upgrading.html">upgrade instructions</a>.</p> <p>This release is a little overdue to say the least. We released the first beta back in February - thinking it would be the only one we did. But one thing lead to another and, four beta releases later, here we are finally with the full release for everyone to enjoy.</p> <p>These delays have had a knock-on effect to our <a href="https://nodered.org/about/releases/">release plan</a>. We’re going to shift things around a bit, but still plan to have Node-RED 4.0 released in the near future to keep up to date with Node.js versions reaching their end-of-life.</p> <p>We’ll also get back to more regular maintenance releases to keep things moving.</p> <p>With all that said, and without our usual accompanying video, lets dig into what 3.1 has to offer. As ever, the <a href="https://github.com/node-red/node-red/releases/tag/3.1.0">Change Log</a> has the full list of changes in this release.</p> <hr /> <ul> <li><a href="#editor-updates">Editor Updates</a> <ul> <li><a href="#change-notifications-on-tabs">Change notifications on tabs</a></li> <li><a href="#a-bigger-workspace">A bigger workspace</a></li> <li><a href="#locking-flows">Locking Flows</a></li> <li><a href="#hiding-flows">Hiding Flows</a></li> <li><a href="#new-group-user-experience">New Group User Experience</a></li> <li><a href="#group-level-scope-for-the-catchstatus">Group-level scope for the Catch/Status</a></li> <li><a href="#updated-context-menu">Updated Context Menu</a></li> <li><a href="#adding-images-to-nodeflow-descriptions">Adding images to node/flow descriptions</a></li> <li><a href="#mermaid-diagrams">Mermaid Diagrams</a></li> <li><a href="#global-environment-variables">Global Environment Variables</a></li> <li><a href="#new-subflow-environment-variables">New subflow environment variables</a></li> <li><a href="#changes-to-how-environment-variables-are-evaluated">Changes to how Environment Variables are evaluated</a></li> <li><a href="#linking-to-node-help">Linking to Node Help</a></li> <li><a href="#deprecating-synchronous-access-to-jsonata">Deprecating synchronous access to JSONata</a></li> <li><a href="#improved-wiring-for-horizontally-aligned-nodes">Improved wiring for horizontally aligned nodes</a></li> </ul> </li> <li><a href="#runtime-updates">Runtime Updates</a> <ul> <li><a href="#individual-http-middleware-for-httpstatic-routes">Individual http middleware for httpStatic routes</a></li> </ul> </li> <li><a href="#whats-next">What’s next?</a></li> </ul> <hr /> <h2 id="editor-updates">Editor Updates</h2> <h3 id="change-notifications-on-tabs">Change notifications on tabs</h3> <p>The tab bar now shows a change icon for any tabs that contain changes. This makes it much easier to find where things have changed in your flows.</p> <p><img src="/blog/content/images/2023/09/tab-changes.png" alt="" /></p> <h3 id="a-bigger-workspace">A bigger workspace</h3> <p>We have occasionally had requests to make the tab canvas bigger. There was even a discussion around making it infinitely large - allowing a flow to be as large as it needs to be. Whilst that’s a nice idea, for this release we’ve simply increased the size of each tab from 5000x5000 to 8000x8000.</p> <p>We’d still recommend using tools like Subflows and Link nodes to help organise your flows, but at least this quick change will give you plenty more space to use if you need it.</p> <h3 id="locking-flows">Locking Flows</h3> <p>You can now lock a flow (tab in the editor) to prevent it from being modified. Whilst locked you cannot edit the nodes, add new nodes, modify the wiring… anything.</p> <p>Why is that useful? You may have a ‘mission critical’ flow that you want to be super careful not to change by accident. You may want to collaborate on some flows with others, but mark some of them as ‘off limits’.</p> <p>With this release anyone is able to lock and unlock flows, but it lays the ground work for a possible future where particular users may not have permission to unlock flows - allowing them to only edit the flows they are allowed to.</p> <p>The options to lock/unlock flows are available in the right-click context menu - as well as a new padlock button in the Info sidebar explorer.</p> <p><img src="/blog/content/images/2023/09/locking-flows-01.png" alt="" /></p> <p><img src="/blog/content/images/2023/09/locking-flows-02.png" alt="" /></p> <p>To make this work, we’ve modified how ‘nodes’ are managed inside the editor to prevent them being modified on locked flows. No apis have changed, but it does mean certain calls might fail if they are attempted on a locked flow. This has had a fair amount of testing across all of the core features of the editor, but 3rd party node authors are a creative bunch and it is possible someone is doing something <del>sneaky</del> unexpected with their node implementation that gets tripped up by this. So if you see any odd/inconsistent behaviour with this feature, please do let us know (and definitely have ready any error messages from the browser’s JavaScript console).</p> <h3 id="hiding-flows">Hiding Flows</h3> <p>We added the ability to hide flows a couple releases ago. This was done use the ‘eye’ icon that appeared when you hovered over the tab.</p> <p>We got plenty of feedback, including our own experience, that it was way too easy to accidentally click that button and make things disappear without realising it.</p> <p>So for this release we’ve gotten rid of that button on the tab. Flows can still be hidden, but you do so via the context menu option when you right-click on the tab bar. You can still use the eye button in the Info sidebar explorer.</p> <h3 id="new-group-user-experience">New Group User Experience</h3> <p>Following feedback from the community on what it was like to work with the groups feature in the editor, they have been given a big overhaul in this release.</p> <p>You can now click on any node, inside or outside of a group, and interact with it directly. No more clicking multiple times to get to a node.</p> <p>Because of that change, you now move a group by clicking on its border and dragging it. But what if you’ve made the border invisible? It now highlights whenever you mouse over it.</p> <p>We’ve also made it possible to drag multiple nodes into a group in one go - previously we only supported dragging one node in at a time.</p> <p>And in response to a particular piece of feedback, if you hold down <code class="language-plaintext highlighter-rouge">alt</code> whilst dragging a selection of nodes inside a group, you can drag them <strong>out</strong> of the group.</p> <p>Overall, this should make for a much for intuitive user experience.</p> <h3 id="group-level-scope-for-the-catchstatus">Group-level scope for the Catch/Status</h3> <p>The Catch/Status nodes could already be configured to handle specific nodes within a flow. They can now also be configured to handle just the nodes in the same group as them (or any nested groups).</p> <p>This gives you more options for organising your flows and their error handling.</p> <h3 id="updated-context-menu">Updated Context Menu</h3> <p>We’ve expanded the usefulness of the Context Menu added in the last release. There are now lots more commonly used options available in the menu, which also provides better options related to what you clicked on to open the menu. This includes right-clicking on the tab bar at the top of the workspace to get flow-specific options.</p> <p><img src="/blog/content/images/2023/09/context-menu-01.png" alt="" /></p> <h3 id="adding-images-to-nodeflow-descriptions">Adding images to node/flow descriptions</h3> <p>All nodes and flows have a Description tab in their edit dialog. This lets you write docs (using markdown) that gets displayed in the Info sidebar when the thing is selected.</p> <p>With this release you can now drag images directly into the markdown editor and they will get inlined. This is done by base64 url encoding the image directly into the description property.</p> <h3 id="mermaid-diagrams">Mermaid Diagrams</h3> <p>We’ve also added support for <a href="https://github.com/mermaid-js/mermaid">Mermaid</a> diagrams. These are diagrams that can be defined directly in the markdown and then rendered out as images when displaying in the sidebar. GitHub recently added support for them, and I’ve found them to be super-useful when documenting things when plain text isn’t quite enough.</p> <p><img src="/blog/content/images/2023/09/mermaid.png" alt="" /></p> <h3 id="global-environment-variables">Global Environment Variables</h3> <p>We’ve supported defining environment variables scoped to individual flows, subflows or groups for a while. But the only way to define an environment variable available to all flows was to do it via your settings file. That wasn’t very accessible or portable.</p> <p>So with this release you can now define global env vars via the User Settings dialog:</p> <p><img src="/blog/content/images/2023/09/global-env-vars.png" alt="" /></p> <p>Under the covers these get added to your flow as a new core configuration node type. That will mean importing a flow from 3.1 with global env vars into an earlier version of Node-RED will lead to an unrecognised node warning - something to be aware of.</p> <h3 id="new-subflow-environment-variables">New subflow environment variables</h3> <p>Within a subflow, you can now use <code class="language-plaintext highlighter-rouge">NR_SUBFLOW_NAME</code> <code class="language-plaintext highlighter-rouge">NR_SUBFLOW_ID</code> and <code class="language-plaintext highlighter-rouge">NR_SUBFLOW_PATH</code> to access those properties of the subflow instance node.</p> <p>These join the existing <code class="language-plaintext highlighter-rouge">NR_NODE_*</code>/<code class="language-plaintext highlighter-rouge">NR_FLOW_*</code> and <code class="language-plaintext highlighter-rouge">NR_GROUP_*</code> equivalents.</p> <h3 id="changes-to-how-environment-variables-are-evaluated">Changes to how Environment Variables are evaluated</h3> <p>Environment variables are statically defined values that cannot be changed whilst the flow is running. There were some edge cases to this, such as using a JSONata expression of <code class="language-plaintext highlighter-rouge">$now()</code> that would get re-evaluated every time it was referenced.</p> <p>Because of the need to make JSONata fully asynchronous in the future, we’ve changed how the env var evaluation is done - their values are now all generated when the flows start and not re-evaluated again.</p> <p>This should not cause any changes in behaviour, unless you were relying on the <code class="language-plaintext highlighter-rouge">$now()</code> trick that was not an intentional behaviour.</p> <p>As nodes can depend on env var values, we’ve also updated the logic around the ‘modified nodes’ and ‘modified flows’ types of deploys. Changing an env var at the flow level will now cause all of the nodes on that flow to be considered modified. This is a bit of a blunt solution for this release and we may refine it to be more selective to only the nodes that reference the changed env var - but that’s for another day.</p> <h3 id="linking-to-node-help">Linking to Node Help</h3> <p>Every node dialog now has a help button in its footer. This will open the Help sidebar and display the… you guessed it… help for the node.</p> <p><img src="/blog/content/images/2023/09/node-help-link.png" alt="" /></p> <h3 id="deprecating-synchronous-access-to-jsonata">Deprecating synchronous access to JSONata</h3> <p>This is one for node authors rather than end users.</p> <p>JSONata 2.0 was recently published and promises a lot of significant performance improvements. However it brings a major breaking change - you can no longer evaluate expressions synchronously. So we can’t upgrade to it quite yet, but we can lay some ground work for it.</p> <p>Since we introduced JSONata into Node-RED, we’ve provided a set of standard APIs for nodes to use. Notably:</p> <ul> <li><code class="language-plaintext highlighter-rouge">RED.util.evaluateNodeProperty</code> - used to evaluate all sorts of standard types of property</li> <li><code class="language-plaintext highlighter-rouge">RED.util.evaluateJSONataExpression</code> - used to evaluate a prepared JSONata expression</li> </ul> <p>Both of these functions accept an optional callback parameter which allows them to evaluate asynchronously - however they both also allow synchronous behaviour.</p> <p>With this release we have <em>deprecated</em> calling <code class="language-plaintext highlighter-rouge">evaluateJSONataExpression</code> without a callback argument. By extension, <code class="language-plaintext highlighter-rouge">evaluateNodeProperty</code> will require a callback <em>if</em> being used with JSONata.</p> <p>Using these APIs without a callback will trigger a warning in the log, along with a full stacktrace that will hopefully help identify the node that caused it.</p> <p>Our intention is to update to JSONata 2.0 in Node-RED 4.0 this summer - so we want to flush out any nodes that need updating.</p> <h3 id="improved-wiring-for-horizontally-aligned-nodes">Improved wiring for horizontally aligned nodes</h3> <p>Following <a href="https://discourse.nodered.org/t/feature-request-little-tweak-on-wires/79336">this</a> discussion on the forum, we’ve made some modifications to the wiring layout logic to improve cases where wires loop back on horizontally laid out nodes.</p> <p>Here is a before/after pair of screenshots:</p> <p> <img width="40%" src="/blog/content/images/2023/09/node-wiring-01.png" alt="" /> <img width="40%" src="/blog/content/images/2023/09/node-wiring-02.png" alt="" /> </p> <h2 id="runtime-updates">Runtime Updates</h2> <h3 id="individual-http-middleware-for-httpstatic-routes">Individual http middleware for httpStatic routes</h3> <p>It is now possible to configure separate middleware functions for different <code class="language-plaintext highlighter-rouge">httpStatic</code> configured routes.</p> <p>See <a href="https://github.com/node-red/node-red/pull/4229">#4229</a> for the details.</p> <h2 id="whats-next">What’s next?</h2> <p>As I mentioned at the start, this release is overdue and has pushed back the existing release plan.</p> <p>With Node.js 16.x reaching its end-of-life <em>next week</em>, we’ll be moving forward with Node-RED 4.0 in the near future. As it stands, we strongly recommend users to be using Node 18 or 20 by now.</p> <p>As an open-source project we are reliant on the contribution of the community. We have a strong and vibrant user community, well demonstrated by the activity on the <a href="https://discourse.nodered.org">forums</a>. It’s great to see the support the community provides each other.</p> <p>If you’re interested in contributing to Node-RED, now is a good time to come over and chat with us in either the <a href="https://discourse.nodered.org">forum</a> or <a href="https://nodered.org/slack">slack</a>.</p> Wed, 06 Sep 2023 00:00:00 +0000 https://nodered.org/blog/2023/09/06/version-3-1-released https://nodered.org/blog/2023/09/06/version-3-1-released 2023 Community Survey <p><strong>Update:</strong> the results are now available <a href="/about/community/survey/2023/">here</a>.</p> <p>Back in 2019 we published the results of the 2019 Node-RED community survey. The results painted an interesting picture of the Node-RED community. We think it is time to refresh these results so we are running the survey again.</p> <p>The 2023 survey is similar to the 2019. We’ve made a few tweaks, removed some questions and added some new ones. The goal is to get a better picture of who our uses are, what they do with Node-RED and to make sure we keep the project pointed in the right direction.</p> <p>The survey will be open until March 31. Of course we would like to get as many respondents as possible. In 2019, we have over 800 individuals respond so hopefully we can meet this number again this year.</p> <p>Once the survey has been completed, we will publish the results for the entire community to see.</p> <p>The survey should take less than 10 minutes to complete. Thank you in advance for your feedback.</p> <p><strong>Update:</strong> The survey is now closed.</p> Thu, 23 Feb 2023 00:00:00 +0000 https://nodered.org/blog/2023/02/23/community-survey https://nodered.org/blog/2023/02/23/community-survey Version 3.0 released <p>Node-RED 3.0 is now available to <a href="https://npmjs.org/package/node-red">install</a>. If upgrading, please read the <a href="http://nodered.org/docs/getting-started/upgrading.html">upgrade instructions</a>.</p> <p>The <a href="https://github.com/node-red/node-red/blob/1b94cc3ac027bfc38a300867a0b0fd635bf273b8/CHANGELOG.md">Change Log</a> has the full list of changes in this release, but here are the highlights.</p> <hr /> <iframe width="560" height="315" src="https://www.youtube.com/embed/R9bV2MytHr0" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen=""></iframe> <hr /> <ul> <li><a href="#migrating-from-node-red-2x">Migrating from Node-RED 2.x</a></li> <li><a href="#editor-features">Editor Features</a> <ul> <li><a href="#context-menu">Context Menu</a></li> <li><a href="#junctions">Junctions</a></li> <li><a href="#debug-path-tooltip">Debug Path Tooltip</a></li> <li><a href="#continuous-search">Continuous Search</a></li> <li><a href="#default-node-names">Default node names</a></li> <li><a href="#monaco-text-editor">Monaco Text Editor</a></li> <li><a href="#remembering-cursor-position">Remembering cursor position</a></li> <li><a href="#accessing-previous-welcome-tours">Accessing previous welcome tours</a></li> </ul> </li> <li><a href="#runtime-features">Runtime Features</a> <ul> <li><a href="#editing-stopped-flows">Editing stopped flows</a></li> <li><a href="#diagnostic-report">Diagnostic Report</a></li> <li><a href="#multiple-static-folders">Multiple static folders</a></li> </ul> </li> <li><a href="#node-updates">Node updates</a> <ul> <li><a href="#dynamic-link-call-node">Dynamic Link Call node</a></li> <li><a href="#environment-variables-in-the-template-node">Environment Variables in the Template node</a></li> <li><a href="#debug-node-message-count">Debug node message count</a></li> <li><a href="#predefined-http-request-headers">Predefined HTTP Request headers</a></li> </ul> </li> <li><a href="#whats-next">What’s next?</a></li> </ul> <h2 id="migrating-from-node-red-2x">Migrating from Node-RED 2.x</h2> <p>Here are the key points you need to know when migrating to Node-RED 3.x.</p> <ul> <li>Node.js 14.x or later required</li> <li>Internet Explorer no longer supported</li> <li>Choose if you want to enable the <a href="#editing-stopped-flows">Stopping Flows</a> feature</li> <li>Choose if you want to <em>disable</em> the <a href="#diagnostic-report">Runtime Diagnostics</a> feature</li> <li>Choose if you want to switch to the <a href="#monaco-text-editor">Monaco editor</a> (if you haven’t already).</li> </ul> <h2 id="editor-features">Editor Features</h2> <h3 id="context-menu">Context Menu</h3> <p>We have (finally) added a right-click context menu in the workspace. This gives you quick access to a lot of built-in actions in the editor and should help users discover more of the features available.</p> <p><img src="/blog/content/images/2022/07/context.png" alt="" /></p> <p>Picking what options should be in the menu hasn’t been a simple task. There are a lot of things that could have been included - so we had to get the right balance between having the right options there and making it too long and hard to find.</p> <h3 id="junctions">Junctions</h3> <p>We have introduced a new special node type called <code class="language-plaintext highlighter-rouge">junction</code> that can make it easier to route the wires in a flow.</p> <p>Unlike the various ‘no-op’ nodes that have been published to the community to help achieve similar results, the Junctions are far more compact and less obtrusive in the flow.</p> <p>When you hover over a Junction, it expands to show input and output ports. You can move the junction by dragging its body, or add a wire by click/dragging on one of its ports - just as you do with nodes.</p> <p><img src="/blog/content/images/2022/07/junctions.gif" alt="" /></p> <p>Junctions do not appear as regular nodes in the palette or flow outline, but can be added through the quick-add dialog (Ctrl-click in the workspace) or the new Context Menu.</p> <p><img src="/blog/content/images/2022/07/jucntion-quick-add.png" alt="" /></p> <p>You can also insert a Junction into an existing wire by slicing through it with the mouse by holding <kbd>alt-shift</kbd> when dragging across the wire. Note that some OS might use that same combination to move the active window, so this won’t work there. We don’t yet have a way to allow the mouse actions to be customised, so users affected by that would have to use the other methods to add Junctions.</p> <h3 id="debug-path-tooltip">Debug Path Tooltip</h3> <p>When hovering over a node name in the Debug sidebar, a new tooltip shows the full location of the node. This is useful when working with subflows, making it much easier to identify exactly which node generated the message.</p> <p>Clicking on any item in the list will reveal it in the workspace.</p> <p><img src="/blog/content/images/2022/07/debug-tooltip.png" alt="" /></p> <h3 id="continuous-search">Continuous Search</h3> <p>When searching for things in the editor, a new toolbar in the workspace provides options to quickly jump between the search results.</p> <p><img src="/blog/content/images/2022/07/search.png" alt="" /></p> <p>We’ve added a pair of new actions to help navigate the results:</p> <ul> <li><code class="language-plaintext highlighter-rouge">core:search-next</code> - shortcut: <kbd>f</kbd></li> <li><code class="language-plaintext highlighter-rouge">core:search-previous</code> - shortcut: <kbd>shift-f</kbd></li> </ul> <p>We’ve also added some more predefined searches, including the ability to restrict the search to the current flow.</p> <p><img src="/blog/content/images/2022/07/search-options.png" alt="" /></p> <h3 id="default-node-names">Default node names</h3> <p>The <code class="language-plaintext highlighter-rouge">Debug</code>, <code class="language-plaintext highlighter-rouge">Function</code> and <code class="language-plaintext highlighter-rouge">Link</code> nodes are now given unique default names when they are added to the workspace.</p> <p><img src="/blog/content/images/2022/07/node-names.gif" alt="" /></p> <p>This capability could be added to any node, including contrib nodes, via their <code class="language-plaintext highlighter-rouge">onadd</code> function. We chose just this initial set as they were the ones that would most benefit from having a name applied.</p> <p>A new action has also been added that will apply an appropriate default name to any selected nodes that don’t currently have a name:</p> <ul> <li><code class="language-plaintext highlighter-rouge">core:generate-node-names</code></li> </ul> <h3 id="monaco-text-editor">Monaco Text Editor</h3> <p>We added the <code class="language-plaintext highlighter-rouge">monaco</code> editor component as an alternative to the default <code class="language-plaintext highlighter-rouge">ace</code> editor a year ago in the 2.x release. It has proven to be very stable and provides a much richer user experience.</p> <p>With 3.0, we have switched over to monaco as the default editor. New installs of Node-RED will pickup the change - existing installs will need to update (or remove) the <code class="language-plaintext highlighter-rouge">codeEditor</code> entry in their settings file.</p> <p>The ultimate goal will be to remove <code class="language-plaintext highlighter-rouge">ace</code> entirely in the 4.0 release next year.</p> <h3 id="remembering-cursor-position">Remembering cursor position</h3> <p>The editor now tries to restore your cursor position when you reopen a node’s edit dialog. This is super handy with the Function node, amongst others, where you don’t want to have to scroll back to where you were working each time you open the edit dialog.</p> <h3 id="accessing-previous-welcome-tours">Accessing previous welcome tours</h3> <p>We introduced the Welcome Tour back in 2.1.0 and it has been updated for each release. With this release, we’ve added a way to access the tours of the previous releases in the Help sidebar:</p> <p><img src="/blog/content/images/2022/07/tours.png" alt="" /></p> <h2 id="runtime-features">Runtime Features</h2> <h3 id="editing-stopped-flows">Editing stopped flows</h3> <p>We’ve introduced the <strong>optional</strong> ability to run Node-RED without the flows themselves running. We already had Safe Mode that achieved a similar result, but with this new feature, you can stop and start the flows directly from the editor. The runtime will remember the state of the flows so when Node-RED starts up, the flows will stay in the same started/stopped state.</p> <p>This feature is <strong>not enabled by default</strong>. To enable it, you need to add the following to your <code class="language-plaintext highlighter-rouge">settings.js</code> file:</p> <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>runtimeState: { enabled: true, ui: true } </code></pre></div></div> <p>With that set, you get a new option in the Deploy menu:</p> <p><img src="/blog/content/images/2022/07/deploy-stop.png" alt="" /></p> <p>Clicking that option will stop the flows running, but you can continue editing them and deploy changes. Whilst stopped, the Inject/Debug node buttons will be disabled.</p> <p>When the flows are stopped, the menu shows a start option instead:</p> <p><img src="/blog/content/images/2022/07/deploy-start.png" alt="" /></p> <h3 id="diagnostic-report">Diagnostic Report</h3> <p>We’ve added a new admin endpoint that returns information about the runtime and the system its running on. This can be used to quickly gather information when reporting an issue.</p> <p>Within the editor you can see the information it returns by running the ‘Show System Info’ action.</p> <p>We have taken care to ensure this does not return anything sensitive. In some cases it will indicate if a particular setting is set, but not what value it has been set to.</p> <p>We realise that not everyone will want to have this exposed depending on how they use Node-RED. For that reason, the endpoint can be disabled by adding the following to <code class="language-plaintext highlighter-rouge">settings.js</code>:</p> <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>diagnostics: { enabled: false } </code></pre></div></div> <h3 id="multiple-static-folders">Multiple static folders</h3> <p>The runtime has long-supported the ability to serve a folder of static content as part of its HTTP handling. Useful for providing static resources to webpages and the like.</p> <p>With this release you can now specify multiple folders to serve from and, more importantly, to specify the http path each folder should be served from.</p> <p>See <a href="https://github.com/node-red/node-red/pull/3542">#3542</a> for details on how it can be used.</p> <h2 id="node-updates">Node updates</h2> <h3 id="dynamic-link-call-node">Dynamic Link Call node</h3> <p>We added the Link Call node in Node-RED 2.1. It lets you create a flow that calls out to a Link In node and get a response back. The main limitation was you had to hardcode what Link In node you wanted it to call.</p> <p>With this release you can now use <code class="language-plaintext highlighter-rouge">msg.target</code> to set the name of the Link In node it should call.</p> <h3 id="environment-variables-in-the-template-node">Environment Variables in the Template node</h3> <p>The Template node can now access environment variables using the syntax:</p> <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>My favourite colour is {{env.COLOUR}}. </code></pre></div></div> <h3 id="debug-node-message-count">Debug node message count</h3> <p>The Debug node has a new option to report how many messages it has received in its status output.</p> <h3 id="predefined-http-request-headers">Predefined HTTP Request headers</h3> <p>The HTTP Request node now allows you to set request headers in the node’s edit dialog - rather than having to always pass them in as message properties.</p> <h2 id="whats-next">What’s next?</h2> <p>As happened with 2.0, we’ve overrun our plan for getting 3.0 released in April. But the series of beta releases we have been doing have really helped improve the overall quality of this release.</p> <p>The main challenge has always been getting enough time and attention dedicated to keep the release cadence going.</p> <p>Our next scheduled main release will be 3.1 in late October/November. As ever, we have a healthy backlog of items to keep us busy - but ultimately it depends very much on the feedback from the community.</p> <p>If you’re interested in contributing to Node-RED, now is a good time to come over and chat with us in either the <a href="https://discourse.nodered.org">forum</a> or <a href="https://nodered.org/slack">slack</a>.</p> <p>Node-Red 2.x is now in maintenance mode - we won’t be added any new features to it, but we will do maintenance releases with fixes as needed. In fact, we’ll have a long overdue 2.2.3 release in the next couple of weeks.</p> Thu, 14 Jul 2022 00:00:00 +0000 https://nodered.org/blog/2022/07/14/version-3-0-released https://nodered.org/blog/2022/07/14/version-3-0-released Introducing the Node Scorecard <p>Last year we asked the community what frustrations they were experiencing as both users and creators of 3rd party nodes. One of the common themes was that it was hard to judge the quality of a node just from looking at its page on the <a href="https://flows.nodered.org">Flow Library</a>.</p> <p>Based on that feedback, we’re now introducing Node Scorecards.</p> <p>The scorecard provides a summary of a Node across a range of things such as whether it follows our naming guidelines, does it have a valid license applied and does it clash with other packages in the library.</p> <p>When we first introduced the Flow Library, we chose not to act as gatekeepers to what can be shared, beyond some very basic checks on the nodes. The scorecard doesn’t change that, but it does help start to highlight where a node may need some additional work to meet the recommended best practices.</p> <p>We’ve been running the tool against new submissions to the Flow Library for a couple months now so there are scorecards for many of the recently updated nodes. You’ll now see a link to ‘View scorecard’ in the sidebar of a node’s page on the library, along with a summary of the scorecard.</p> <p><img src="/blog/content/images/2022/01/node-page.png" alt="" /></p> <p>Click through gives you a more detailed view of the scorecard - listing out all of the checks made. You can find out more about the purpose of each check by clicking on the i link on the right hand side.</p> <p><img src="/blog/content/images/2022/01/node-scorecard.png" alt="" /></p> <h3 id="changing-our-recommended-naming-convention">Changing our recommended naming convention</h3> <p>As part of the work to improve the overall quality of the Flow Library, we’re making a change to our <a href="/docs/creating-nodes/packaging#naming">naming guidelines for node modules</a>.</p> <p>Previously, we asked that if a module’s name started with <code class="language-plaintext highlighter-rouge">node-red-</code>, that it use <code class="language-plaintext highlighter-rouge">node-red-contrib-</code> to distinguish it from modules maintained by the core project.</p> <p>We now recommend that <em>newly published</em> modules use a <a href="https://docs.npmjs.com/cli/v8/using-npm/scope">scoped name</a> - such as <code class="language-plaintext highlighter-rouge">@myScope/node-red-sample</code>. That can be your own user scope, or an organisation scope.</p> <p>If you use a scoped name, there are no further requirements on the name. You could use <code class="language-plaintext highlighter-rouge">@myScope/node-red-sample</code> or just <code class="language-plaintext highlighter-rouge">@myScope/sample</code> - although having <code class="language-plaintext highlighter-rouge">node-red</code> in the name does help to associate the module with the project.</p> <p>If you are forking an existing package to provide a fix, you can keep the same name but released under your own scope. But please keep in mind, forking should always be a last resort if the original maintainer is not responsive to your contributions.</p> <p>We won’t be asking anyone to republish their existing modules under this new naming convention, but the scorecard will flag up any newly added modules that don’t follow this new convention from today.</p> <h3 id="node-developers">Node Developers</h3> <p>The tool underlying the scorecard is <a href="https://www.npmjs.com/package/node-red-dev"><code class="language-plaintext highlighter-rouge">node-red-dev</code></a> - a new command-line tool that developers can run locally against their own code to check for any possible issues before publishing to npm. Many of the checks are quick and easy to fix - much better to do so before sharing with the community.</p> <p>You can run the tool either against a path on your local machine or against a package already published to npm using the appropriate flags, and you’ll get the results in the console</p> <p><img src="/blog/content/images/2022/01/node-red-dev.png" alt="" /></p> <h3 id="the-future">The Future</h3> <p>This is the first step in improving the quality of our node ecosystem, over time we will add more checks to the scorecard. It doesn’t currently examine the code of a node, but that is certainly something that could be explored.</p> <p>There’s also a lot more that <code class="language-plaintext highlighter-rouge">node-red-dev</code> could do for Node Developers beyond the scorecard check. For example, using it to bootstrap development of a new node module, with all of the best practices pre-applied.</p> <p>If that’s something you’re interested in contributing to, please do come talk to us in the <a href="https://discourse.nodered.org">forum</a>.</p> Mon, 31 Jan 2022 00:00:00 +0000 https://nodered.org/blog/2022/01/31/introducing-scorecard https://nodered.org/blog/2022/01/31/introducing-scorecard