hassio-addons / addon-node-red

Node-RED - Home Assistant Community Add-ons
https://addons.community
MIT License
536 stars 125 forks source link

After 16.02 file function node can't find the files #1742

Closed jdesai61 closed 11 months ago

jdesai61 commented 11 months ago

Problem/Motivation

I had some file function nodes that referenced code inside a file. The location of file supposed to be relative to userDir settings - which was fixed to /config/node-red in previous versions. Now with 16.02, the /config/node-red got migrated to /addon_configs/a0d7b954_nodered folder. My file is still there in ./lib/functions directory in the new location, but I can't seem to refer to it using

/config/node-red/lib/funtions/convertBigTimerRemainingTime.js or 
./lib/functions/convertBigTimerRemainingTime.js or 
/addon_configs/a0d7b954_nodered/lib/functions/convertBigTimerRemainingTime.js

Error message I get in node-red logs is below:

"Could not find file "/config/node-red/lib/functions/convertBigTimerRemainingTime.js". Hint: File path is relative to "/opt""

I could move the file under /opt, but I am afraid that the file will get lost on a new version of node-red add-on and it may not get backed up properly. I am looking for recommended new accepted way of storing user function files after 16.0.x release that can survive upgrades and are backed up. Thanks

sinclairpaul commented 11 months ago

Remove the node-red from the path i.e. just /config/lib/functions/convertBigTimerRemainingTime.js

perfrank commented 11 months ago

Allmost the same here, except my files are in /config/

sinclairpaul commented 11 months ago

@perfrank Please post logs, a me too doesn't help me help you :)

perfrank commented 11 months ago

I understand. I'll try to be specific. I get the error in a Write File Node. Path is set to "/config/per/inverterdata.txt". Data in payload.

This comes up in Debug:

15.11.2023 23.58.29node: ebd341581b62ecab http://10.0.4.179:1880/#msg : string[102] "failed to write to file: Error: ENOENT: no such file or directory, open '/config/per/inverterdata.txt' Node Red log says:

5 Nov 23:58:28 - [info] [growatt:Growatt] perfrank 15 Nov 23:58:28 - [error] [file:ebd341581b62ecab] failed to write to file: Error: ENOENT: no such file or directory, open '/config/per/inverterdata.txt' 15 Nov 23:58:56 - [error] [http request:3e551aaf0b68f39e] RequestError: connect EHOSTUNREACH 31.208.22.43:8889 15 Nov 23:58:59 - [info] [ping:Per] ping - Host '10.0.4.162' process timeout - sending SIGINT

If You need other logs, please tell me, with a hint where to find them.

The error started after updating to 16.02. No problems until then.

Thank you very much for taking the time to help.

Med venlig hilsen / best regards

Per Frank-Hansen Søvej 3 2665 Vallensbæk Strand +45 20837692

Den ons. 15. nov. 2023 kl. 23.52 skrev Paul Sinclair < @.***>:

@perfrank https://github.com/perfrank Please post logs, a me too doesn't help me help you :)

— Reply to this email directly, view it on GitHub https://github.com/hassio-addons/addon-node-red/issues/1742#issuecomment-1813393038, or unsubscribe https://github.com/notifications/unsubscribe-auth/AI3K37UBPZKYUFOVHPJDZN3YEVBRLAVCNFSM6AAAAAA7NGOG7SVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMJTGM4TGMBTHA . You are receiving this because you were mentioned.Message ID: @.***>

sinclairpaul commented 11 months ago

@perfrank Then I would suggest your issue is slightly different, please confirm that the folder per exists within the new addon location. You can view this via the SSH/VSCode/Samba addons.

perfrank commented 11 months ago

Hi Paul

Yes, the folder and file exists and can be seen by both Samba and Studio Code Server: /config/per/inverterdata.txt.

Med venlig hilsen / best regards

Per Frank-Hansen Søvej 3 2665 Vallensbæk Strand +45 20837692

Den tors. 16. nov. 2023 kl. 00.33 skrev Paul Sinclair < @.***>:

@perfrank https://github.com/perfrank Then I would suggest your issue is slightly different, please confirm that the folder per exists within the new addon location. You can view this via the SSH/VSCode/Samba addons.

— Reply to this email directly, view it on GitHub https://github.com/hassio-addons/addon-node-red/issues/1742#issuecomment-1813459221, or unsubscribe https://github.com/notifications/unsubscribe-auth/AI3K37ROFI2HG7UH4WPJAT3YEVGODAVCNFSM6AAAAAA7NGOG7SVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMJTGQ2TSMRSGE . You are receiving this because you were mentioned.Message ID: @.***>

sinclairpaul commented 11 months ago

So within Code Server you should see it as /addon_configs/a0d7b954_nodered/per/inverterdata.txt

What has happened is that the addon folders have been relocated to something which can be managed by the addon/backup process, this will still appear in the container as /config, however from an external view the paths have changed.

G4KCM commented 11 months ago

Now Resolved by restoring BU as detailed elsewhere

Hi, since the 16.02 version and likely the earlier one all of mr flows have disappeared and ceased to function. This has crippled my system. Please advise / issue a fix asap. Logs below.

Thank you

s6-rc: info: service s6rc-oneshot-runner: starting s6-rc: info: service s6rc-oneshot-runner successfully started s6-rc: info: service base-addon-banner: starting


Add-on: Node-RED Flow-based programming for the Internet of Things

Add-on version: 16.0.2 You are running the latest version of this add-on. System: Home Assistant OS 11.1 (amd64 / generic-x86-64) Home Assistant Core: 2023.11.2 Home Assistant Supervisor: 2023.11.3

Please, share the above information when looking for help or support in, e.g., GitHub, forums or the Discord chat.

s6-rc: info: service base-addon-banner successfully started s6-rc: info: service fix-attrs: starting s6-rc: info: service base-addon-log-level: starting s6-rc: info: service fix-attrs successfully started s6-rc: info: service base-addon-log-level successfully started s6-rc: info: service legacy-cont-init: starting s6-rc: info: service legacy-cont-init successfully started s6-rc: info: service init-nginx: starting s6-rc: info: service init-customizations: starting s6-rc: info: service init-customizations successfully started s6-rc: info: service init-nodered: starting s6-rc: info: service init-nginx successfully started

up to date, audited 74 packages in 2s

2 packages are looking for funding run npm fund for details

5 moderate severity vulnerabilities

To address issues that do not require attention, run: npm audit fix

Some issues need review, and may require choosing a different dependency.

Run npm audit for details. s6-rc: info: service init-nodered successfully started s6-rc: info: service nodered: starting s6-rc: info: service nodered successfully started s6-rc: info: service nginx: starting s6-rc: info: service nginx successfully started s6-rc: info: service legacy-services: starting s6-rc: info: service legacy-services successfully started [07:26:06] INFO: Starting Node-RED...

start node $NODE_OPTIONS node_modules/node-red/red.js --settings /etc/node-red/config.js

16 Nov 07:26:07 - [info]

Welcome to Node-RED

16 Nov 07:26:07 - [info] Node-RED version: v3.1.0 16 Nov 07:26:07 - [info] Node.js version: v18.18.2 16 Nov 07:26:07 - [info] Linux 6.1.59 x64 LE 16 Nov 07:26:07 - [info] Loading palette nodes 16 Nov 07:26:08 - [info] Dashboard version 3.6.1 started at /endpoint/ui 16 Nov 07:26:08 - [info] Settings file : /etc/node-red/config.js 16 Nov 07:26:08 - [info] Context store : 'default' [module=memory] 16 Nov 07:26:08 - [info] User directory : /config/ 16 Nov 07:26:08 - [warn] Projects disabled : editorTheme.projects.enabled=false 16 Nov 07:26:08 - [info] Flows file : /config/flows.json 16 Nov 07:26:08 - [info] Server now running at http://127.0.0.1:46836/ 16 Nov 07:26:08 - [info] Starting flows 16 Nov 07:26:08 - [info] Started flows [07:26:09] INFO: Starting NGinx... 16 Nov 07:26:13 - [info] [server:Home Assistant] Connecting to http://supervisor/core 16 Nov 07:26:13 - [info] [server:Home Assistant] Connected to http://supervisor/core

perfrank commented 11 months ago

Had the same issue. I solved it this way:

In addon_configs\a0d7b954_nodered I found the files flows.json and .flows.json.backup. The difference in size indicated, that .flows.json.backup might contain the missed flows.

In Node Red, Import I imported the backup file and deployed. As by miracel, my flows was back.

I am not an expert in HA and NR. I found this solution by luck and logic. I hope that others might have the same luck.

Med venlig hilsen / best regards

Per Frank-Hansen

Den tors. 16. nov. 2023 kl. 08.37 skrev G4KCM @.***>:

Hi, since the 16.02 version and likely the earlier one all of mr flows have disappeared and ceased to function. This has crippled my system. Please advise / issue a fix asap. Logs below.

Thank you

s6-rc: info: service s6rc-oneshot-runner: starting s6-rc: info: service s6rc-oneshot-runner successfully started s6-rc: info: service base-addon-banner: starting

Add-on: Node-RED Flow-based programming for the Internet of Things Add-on version: 16.0.2 You are running the latest version of this add-on. System: Home Assistant OS 11.1 (amd64 / generic-x86-64) Home Assistant Core: 2023.11.2 Home Assistant Supervisor: 2023.11.3 Please, share the above information when looking for help or support in, e.g., GitHub, forums or the Discord chat.

s6-rc: info: service base-addon-banner successfully started s6-rc: info: service fix-attrs: starting s6-rc: info: service base-addon-log-level: starting s6-rc: info: service fix-attrs successfully started s6-rc: info: service base-addon-log-level successfully started s6-rc: info: service legacy-cont-init: starting s6-rc: info: service legacy-cont-init successfully started s6-rc: info: service init-nginx: starting s6-rc: info: service init-customizations: starting s6-rc: info: service init-customizations successfully started s6-rc: info: service init-nodered: starting s6-rc: info: service init-nginx successfully started

up to date, audited 74 packages in 2s

2 packages are looking for funding run npm fund for details

5 moderate severity vulnerabilities

To address issues that do not require attention, run: npm audit fix

Some issues need review, and may require choosing a different dependency.

Run npm audit for details. s6-rc: info: service init-nodered successfully started s6-rc: info: service nodered: starting s6-rc: info: service nodered successfully started s6-rc: info: service nginx: starting s6-rc: info: service nginx successfully started s6-rc: info: service legacy-services: starting s6-rc: info: service legacy-services successfully started [07:26:06] INFO: Starting Node-RED...

start node $NODE_OPTIONS node_modules/node-red/red.js --settings /etc/node-red/config.js

16 Nov 07:26:07 - [info] Welcome to Node-RED

16 Nov 07:26:07 - [info] Node-RED version: v3.1.0 16 Nov 07:26:07 - [info] Node.js version: v18.18.2 16 Nov 07:26:07 - [info] Linux 6.1.59 x64 LE 16 Nov 07:26:07 - [info] Loading palette nodes 16 Nov 07:26:08 - [info] Dashboard version 3.6.1 started at /endpoint/ui 16 Nov 07:26:08 - [info] Settings file : /etc/node-red/config.js 16 Nov 07:26:08 - [info] Context store : 'default' [module=memory] 16 Nov 07:26:08 - [info] User directory : /config/ 16 Nov 07:26:08 - [warn] Projects disabled : editorTheme.projects.enabled=false 16 Nov 07:26:08 - [info] Flows file : /config/flows.json 16 Nov 07:26:08 - [info] Server now running at http://127.0.0.1:46836/ 16 Nov 07:26:08 - [info] Starting flows 16 Nov 07:26:08 - [info] Started flows [07:26:09] INFO: Starting NGinx... 16 Nov 07:26:13 - [info] [server:Home Assistant] Connecting to http://supervisor/core 16 Nov 07:26:13 - [info] [server:Home Assistant] Connected to http://supervisor/core

— Reply to this email directly, view it on GitHub https://github.com/hassio-addons/addon-node-red/issues/1742#issuecomment-1813930233, or unsubscribe https://github.com/notifications/unsubscribe-auth/AI3K37QWT3UK3DZJ6EXF4OLYEW7DHAVCNFSM6AAAAAA7NGOG7SVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMJTHEZTAMRTGM . You are receiving this because you were mentioned.Message ID: @.***>

perfrank commented 11 months ago

Ok, I was not aware of this. It also explains why all my flows disappeared. That issue I resolved by importing .flows.yaml.backup im NR.

I copied /per to /addon_configs/a0d7b954_nodered and it seems to work now.

Thanks again for Your help. I started on HA late in life, and the learning curve is not as steep as it used to be. Being new in linux, yaml and javascript and a high ambition with respect to energy control, I really struggle from time to time. This is the first time I tried asking for help in a forum, but I will definitely do it again:-)

Med venlig hilsen / best regards

Per Frank-Hansen

Den tors. 16. nov. 2023 kl. 02.56 skrev Paul Sinclair < @.***>:

So within Code Server you should see it as /addon_configs/a0d7b954_nodered/per/inverterdata.txt

What has happened is that the addon folders have been relocated to something which can be managed by the addon/backup process, this will still appear in the container as /config, however from an external view the paths have changed.

— Reply to this email directly, view it on GitHub https://github.com/hassio-addons/addon-node-red/issues/1742#issuecomment-1813643997, or unsubscribe https://github.com/notifications/unsubscribe-auth/AI3K37VAWFFOCMHH3DOTDHLYEVXFNAVCNFSM6AAAAAA7NGOG7SVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMJTGY2DGOJZG4 . You are receiving this because you were mentioned.Message ID: @.***>

G4KCM commented 11 months ago

Had the same issue. I solved it this way: In addon_configs\a0d7b954_nodered I found the files flows.json and .flows.json.backup. The difference in size indicated, that .flows.json.backup might contain the missed flows. In Node Red, Import I imported the backup file and deployed. As by miracel, my flows was back. I am not an expert in HA and NR. I found this solution by luck and logic. I hope that others might have the same luck. Med venlig hilsen / best regards Per Frank-Hansen Den tors. 16. nov. 2023 kl. 08.37 skrev G4KCM @.>: Hi, since the 16.02 version and likely the earlier one all of mr flows have disappeared and ceased to function. This has crippled my system. Please advise / issue a fix asap. Logs below. Thank you s6-rc: info: service s6rc-oneshot-runner: starting s6-rc: info: service s6rc-oneshot-runner successfully started s6-rc: info: service base-addon-banner: starting ------------------------------ Add-on: Node-RED Flow-based programming for the Internet of Things Add-on version: 16.0.2 You are running the latest version of this add-on. System: Home Assistant OS 11.1 (amd64 / generic-x86-64) Home Assistant Core: 2023.11.2 Home Assistant Supervisor: 2023.11.3 Please, share the above information when looking for help or support in, e.g., GitHub, forums or the Discord chat. s6-rc: info: service base-addon-banner successfully started s6-rc: info: service fix-attrs: starting s6-rc: info: service base-addon-log-level: starting s6-rc: info: service fix-attrs successfully started s6-rc: info: service base-addon-log-level successfully started s6-rc: info: service legacy-cont-init: starting s6-rc: info: service legacy-cont-init successfully started s6-rc: info: service init-nginx: starting s6-rc: info: service init-customizations: starting s6-rc: info: service init-customizations successfully started s6-rc: info: service init-nodered: starting s6-rc: info: service init-nginx successfully started up to date, audited 74 packages in 2s 2 packages are looking for funding run npm fund for details 5 moderate severity vulnerabilities To address issues that do not require attention, run: npm audit fix Some issues need review, and may require choosing a different dependency. Run npm audit for details. s6-rc: info: service init-nodered successfully started s6-rc: info: service nodered: starting s6-rc: info: service nodered successfully started s6-rc: info: service nginx: starting s6-rc: info: service nginx successfully started s6-rc: info: service legacy-services: starting s6-rc: info: service legacy-services successfully started [07:26:06] INFO: Starting Node-RED... start node $NODE_OPTIONS node_modules/node-red/red.js --settings /etc/node-red/config.js 16 Nov 07:26:07 - [info] Welcome to Node-RED 16 Nov 07:26:07 - [info] Node-RED version: v3.1.0 16 Nov 07:26:07 - [info] Node.js version: v18.18.2 16 Nov 07:26:07 - [info] Linux 6.1.59 x64 LE 16 Nov 07:26:07 - [info] Loading palette nodes 16 Nov 07:26:08 - [info] Dashboard version 3.6.1 started at /endpoint/ui 16 Nov 07:26:08 - [info] Settings file : /etc/node-red/config.js 16 Nov 07:26:08 - [info] Context store : 'default' [module=memory] 16 Nov 07:26:08 - [info] User directory : /config/ 16 Nov 07:26:08 - [warn] Projects disabled : editorTheme.projects.enabled=false 16 Nov 07:26:08 - [info] Flows file : /config/flows.json 16 Nov 07:26:08 - [info] Server now running at http://127.0.0.1:46836/ 16 Nov 07:26:08 - [info] Starting flows 16 Nov 07:26:08 - [info] Started flows [07:26:09] INFO: Starting NGinx... 16 Nov 07:26:13 - [info] [server:Home Assistant] Connecting to http://supervisor/core 16 Nov 07:26:13 - [info] [server:Home Assistant] Connected to http://supervisor/core — Reply to this email directly, view it on GitHub <#1742 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AI3K37QWT3UK3DZJ6EXF4OLYEW7DHAVCNFSM6AAAAAA7NGOG7SVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMJTHEZTAMRTGM . You are receiving this because you were mentioned.Message ID: @.>

Thanks Frank, I did a restore of node-red and HA core from three days ago and then updated to 16.02 node red all good except I lost a few other changes I had made to automations, now all fixed. Rgds

sinclairpaul commented 11 months ago

I'm closing this out as it should be resolved.

Please don't add unrelated comments to issues, or add comments without searching for other existing known issues.

If you need some kind of discussion, please use the Forums and or Discord.