ioBroker/ioBroker.node-red

Since update to 5.1 Node-RED doesn't read locally saved context files anymore

Closed this issue · 4 comments

I updated the ioBroker Adapter of Node-RED to version 5.1 and after the adapter restart I noticed that the locally saved file of context data (saved by previous Node-RED versions in .\ioBroker\iobroker-data\node-red\context\xxx\flow.json) isn't loaded as context data anymore. Only the context-data which is written in memory is loaded upon start. If I manually trigger a save to (local) file it will get loaded into context data but not saved in the file that was mentioned above and used by previous versions of Node-RED but somewhere else. Where? I don't know.

Problem is solved. The issue was the file .\opt\iobroker\node_modules\iobroker.node-red\settings.js was apparently overwritten during the update so the manually added Node-RED context file options weren't active anymore.

This post helped me to solve my problem.

The issue was the file .\opt\iobroker\node_modules\iobroker.node-red\settings.js was apparently overwritten

The file will be overwritten when the instance start. Let me know which config changed do you need and we can discuss to add those flags / options to the default or make them configurable.

The issue was the file .\opt\iobroker\node_modules\iobroker.node-red\settings.js was apparently overwritten

The file will be overwritten when the instance start. Let me know which config changed do you need and we can discuss to add those flags / options to the default or make them configurable.

That's not what I can confirm. As mentioned in this post the file .\iobroker\node_modules\iobroker.node-red\settings.js (once edited to my liking) won't get overwritten during the start of Node-RED (like you mentioned) but will only get overwritten if there is an update (like in my case to version 5.1) which was the reason for my locally saved context data to not get loaded anymore.

I changed this in the settings.js file:

         /** Context Storage
          * The following property can be used to enable context storage. The configuration
          * provided here will enable file-based context that flushes to disk every 30 seconds.
          * Refer to the documentation for further options: https://nodered.org/docs/api/context/
          */
         contextStorage: {
         default: "file",
         file: { module: "localfilesystem" },
         memory: { module: "memory" }
     },

However if you edit the settings.js file in .\iobroker\iobroker-data\node-red\ it WILL get overwritten during each start up. But that is no problem for me as I'm fine with only needing to edit the file .\iobroker\node_modules\iobroker.node-red\settings.js every time there is an update to Node-RED. I didn't know that I had to do that anymore since the last update before 5.1 was quite a while ago.

That's not what I can confirm. As mentioned in this post the file .\iobroker\node_modules\iobroker.node-red\settings.js

Ah, you edit the template. Sorry I've haven't seen that. I agree that "persistent context" should be an option.

Maybe we have to write an own module to ensure that the context will survive an update of node-red.