Nodered - camera.snapshot cannot write anymore

After the last update they changed the folder mapping so now my “call service” node doesn’t work anymore. No errors shown though.
I was using this path: /config/www/myfolder.

I’ve tried to change it accordingly to the new map structure using /homeassistant or /share but it doesn’t work rising an error this time.

“Call-service error. Cannot write /homeassistant/my_path/gate_state.jpg, no access to path; allowlist_external_dirs may need to be adjusted in configuration.yaml

Do I just need to add the path? Shouldn’t it work already?

1 Like

You are on NR 16.0.2 now?

If so it has to do with the recent move of your NR folder into the addon_config folder) Which resides on the NR container disk space NOT thee same disk space as core. The system is protecting you from yourself. (isn’t that helpful?)

It basically doesn’t have access to write there anymore. Same issue this guy is fighting in his thread here:

Samba Update where is the filepath now? - #57 by NathanCu) pointed at that post because that lists the folders you’re allowed to see and work with according to how NR’s docker container is configured for 16.0.2

We’ve been able to Id what you should be able to write to but haven’t been able to work out the nuance of where you can actually write. Without editing your config in the addon.

Edit:started this thread to discuss the folder mapping in more general terms you’re not the only person dealing with this one.

Thanks, yeah, apparently the shared folders are readable but not writable … or so it seems. I tried /homeassitant and /share that are visible with no luck.
i will check those 3ds and dig a bit into NR conf to see if I can find something.

1 Like

Yeah I spent all day (besides my day job) on that yesterday so I need to do other stuff this morning but I plan to roll back at looking at it after lunch.

Here is the corresponding Github issue:

2 Likes

After many detours here is the (current) solution:

You have to change the folder path to /homeassistant/www/… for all Node Red nodes,
EXCEPT for any Call Service nodes.
Call Service nodes still need /config/www/… to work, as the targeted service is executed in the HA context, not in the Node Red context.

As @earto said in the Github issue, this solution has the potential to create a veritable mess in your Node Red flows.

2 Likes

Thanks Jpsy, it took me a few moments to realize where the issue where even knowing that. In the end I had two different nodes with the path written in.
Now it got back working, but yeah, if you have many nodes and paths set it would be really confusing on many levels.

1 Like

Ok hopping in also… I discovered today I have this exact issue…

I changed from config to homeassistant but now I get:
all-service error. Cannot write /homeassistant/www/snapshot.jpg, no access to path; allowlist_external_dirs may need to be adjusted in `configuration.yaml

I do not seem to read a solution in any thread I found. Can anyone please help me to get going what worked wel over 3 years?

Read my last post.

Tried that as well, but it seems not to work with the “old” (config) as well…

Which nodes? Can we see some config of these nodes?

Ok, think you’re right.

setting config/www in call service node and using homeassistant/www in function node makes it work again.

1 Like

I’m having some issues writing a camera snapshot to home assistant, I’ve read many posts but having no luck. I have HA and Node Red running in a Docker container on a NUC.

6 Dec 18:11:12 - [info] Node-RED version: v3.1.1
6 Dec 18:11:12 - [info] Node.js  version: v16.20.2
6 Dec 18:11:12 - [info] Linux 5.15.0-89-generic x64 LE
6 Dec 18:11:13 - [info] Loading palette nodes
6 Dec 18:11:15 - [info] Settings file  : /usr/src/node-red/.node-red/settings.js
6 Dec 18:11:15 - [info] Context store  : 'default' [module=memory]
6 Dec 18:11:15 - [info] User directory : /usr/src/node-red/.node-red
6 Dec 18:11:15 - [warn] Projects disabled : editorTheme.projects.enabled=false
6 Dec 18:11:15 - [info] Flows file     : /usr/src/node-red/.node-red/flows.json
6 Dec 18:11:15 - [info] Creating new flow file
6 Dec 18:11:15 - [warn]

Using the call service node I can write the snapshot to the folder: {"filename":"/config/www/snapshot_sonoffcam.jpg"}

Using the Write File node with the following path: /homeassistant/www/test.jpg I get the following error: “failed to write to file: Error: ENOENT: no such file or directory, open ‘/homeassistant/www/test.jpg’

I have tried the following variations of the path, but no luck.

/homeassistant/local/
/homeassistant/config/

If I use the following path: homeassistant/www/test.jpg there is no error however I can’t see the file using Visual Studio in the www folder.

I have added the following to configuration.yaml but no luck:

map:
  - addon_config: rw
  - homeassistant_config: rw
  - media: rw
  - share: rw
  - www: rw
  - local:  rw
  - community: rw

I have built the following function node to see if I can retrieve the image to send via Telegram but no luck

msg.payload = {}
msg.payload.chatId = 123
msg.payload.type = "photo"
msg.payload.content = "/homeassistant/www/snapshot_sonoffcam.jpg"
return msg;

Any ideas?

Are you running Node Red in a separate docker container? Not as a HA add-on?
If so then all that is said here does not apply to you. Your system is special and you should open up a separate thread for your question.

Yes, they are in separate containers. Ok, thank you, I’ll open up a separate thread.

1 Like