Open Slyke opened 2 days ago
My workaround:
Edit file ./node_modules/node-red-contrib-home-assistant-websocket/dist/common/services/StorageService.js
:
Change function defined on line 36 checkPermissions()
to:
checkPermissions(path) {
if (!path)
return true;
try {
fs_1.default.accessSync(path, fs_1.default.constants.R_OK | fs_1.default.constants.W_OK);
}
catch (err) {
// throw new Error('Cannot read/write to storage file for Home Assistant nodes'); // Comment out this line
// Add these 2 lines:
console.error('Cannot read/write to storage file for Home Assistant nodes: ', err);
return true;
}
return true;
}
The error it produces by the way is:
Cannot read/write to storage file for Home Assistant nodes Error: EACCES: permission denied, access '/data'
at Object.accessSync (node:fs:243:11)
at Storage.checkPermissions (/data/node_modules/node-red-contrib-home-assistant-websocket/dist/common/services/StorageService.js:40:26)
at Storage.init (/data/node_modules/node-red-contrib-home-assistant-websocket/dist/common/services/StorageService.js:56:18)
at exports.default (/data/node_modules/node-red-contrib-home-assistant-websocket/dist/index.js:84:36)
at loadNodeSet (/usr/src/node-red/node_modules/@node-red/registry/lib/loader.js:359:27)
at /usr/src/node-red/node_modules/@node-red/registry/lib/loader.js:453:31
at Array.forEach (<anonymous>)
at loadNodeSetList (/usr/src/node-red/node_modules/@node-red/registry/lib/loader.js:448:11)
at /usr/src/node-red/node_modules/@node-red/registry/lib/loader.js:145:16 {
errno: -13,
code: 'EACCES',
syscall: 'access',
path: '/data'
}
Describe the bug
This looks to be similar to https://github.com/zachowj/node-red-contrib-home-assistant-websocket/issues/678.
Being mounted from NFS share on a K8s cluster. I'm using
v0.74.2
. I upgraded from some ancient version from like 2022.I have an initContainer that runs on startup:
But also get this error. Here's file info:
The
node-red-contrib-home-assistant-websocket.json
file has an empty JSON object in it:{}
. Deleting this file, and restarting NodeRed does not recreate it.Logs:
Setting
chmod 777
in the initContainer does not fix it.To Reproduce
No response
Expected behavior
Should not error
Screenshots
No response
Example Flow
No response
Environment Information
Node-RED version: v4.0.5 Node.js version: v22.9.0 Linux 5.15.0-124-generic x64 LE
Additional context
No response