Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node Red crash on full deploy Cannot read properties of undefined (reading 'startsWith') #18

Open
Zehir opened this issue Dec 18, 2021 · 5 comments

Comments

@Zehir
Copy link

Zehir commented Dec 18, 2021

Hello,

I using Node-Red inside Home assistant plugin and this plugin is installed by default but I don't use it.
When I hit the deploy button Node-Red crashes and restart. Same with all flows disabled.

I get this stack trace :

18 Dec 13:17:49 - [info] Stopping modified nodes
18 Dec 13:17:49 - [info] Stopped modified nodes
18 Dec 13:17:49 - [info] Starting modified nodes
18 Dec 13:17:49 - [red] Uncaught Exception:
18 Dec 13:17:49 - [error] TypeError: Cannot read properties of undefined (reading 'startsWith')
    at map (/opt/node_modules/node-red-contrib-actionflows/actionflows/actionflows.js:297:27)
    at EventEmitter.runtimeMap (/opt/node_modules/node-red-contrib-actionflows/actionflows/actionflows.js:593:5)
    at EventEmitter.emit (node:events:390:28)
    at start (/opt/node_modules/@node-red/runtime/lib/flows/index.js:383:12)
[13:17:50] INFO: Starting Node-RED...

When I disable all 3 nodes of the plugin from the node palette NR don't crash anymore.

I using Node Red 2.1.4 and version 2.0.4 of the plugin

Thanks

@outlying
Copy link

The same problem started after the Node-Red upgrade, earlier nothing like that. I don't remember what was a version of Node-RED I used prior to the upgrade but I think something like 2.0, installed a year ago

I'm using Node-Red via Home Assistant.

I'm using ActionFlows in a few places but only with the Set rule, nothing fancy - and before upgrade I had no issue with startsWith

Stacktrace is almost the same as the one provided by @Zehir, in my case happens when I use full deploy or modified flows deploy

27 Dec 14:18:14 - [info] Stopping flows
27 Dec 14:18:14 - [info] [server:Home Assistant] Closing connection to undefined
27 Dec 14:18:14 - [info] [zigbee2mqtt-server:ZigBee local] MQTT Unsubscribe from mqtt topic: zigbee2mqtt/#
27 Dec 14:18:14 - [info] [zigbee2mqtt-server:ZigBee local] MQTT connection closed
27 Dec 14:18:14 - [info] Stopped flows
27 Dec 14:18:14 - [info] [zigbee2mqtt-server:ZigBee local] MQTT Close
27 Dec 14:18:14 - [info] [zigbee2mqtt-server:ZigBee local] MQTT End
27 Dec 14:18:14 - [info] Starting flows
27 Dec 14:18:15 - [red] Uncaught Exception:
27 Dec 14:18:15 - [error] TypeError: Cannot read properties of undefined (reading 'startsWith')
    at map (/opt/node_modules/node-red-contrib-actionflows/actionflows/actionflows.js:297:27)
    at EventEmitter.runtimeMap (/opt/node_modules/node-red-contrib-actionflows/actionflows/actionflows.js:593:5)
    at EventEmitter.emit (node:events:402:35)
    at start (/opt/node_modules/@node-red/runtime/lib/flows/index.js:383:12)
[14:18:15] INFO: Starting Node-RED...
27 Dec 14:57:52 - [info] Stopping modified flows
27 Dec 14:57:52 - [info] [mqtt-broker:HASS Broker] Disconnected from broker: mqtt://localhost:1883
27 Dec 14:57:52 - [info] Stopped modified flows
27 Dec 14:57:52 - [info] Starting modified flows
27 Dec 14:57:52 - [red] Uncaught Exception:
27 Dec 14:57:52 - [error] TypeError: Cannot read properties of undefined (reading 'startsWith')
    at map (/opt/node_modules/node-red-contrib-actionflows/actionflows/actionflows.js:297:27)
    at EventEmitter.runtimeMap (/opt/node_modules/node-red-contrib-actionflows/actionflows/actionflows.js:593:5)
    at EventEmitter.emit (node:events:402:35)
    at start (/opt/node_modules/@node-red/runtime/lib/flows/index.js:383:12)
[14:57:53] INFO: Starting Node-RED...

Home Assistant Community Add-on: Node-RED 10.2.2
Node-RED v2.1.4

@outlying
Copy link

I suspect that version 2.0.4 of the plugin is not compatible with 2.1.x Node-RED, my JS is at best basic but I've seen that code is failing here

if (flows[x].type.startsWith("actionflows")) {

New code (master; current state) is handling things a little bit differently, so I assume this is how things should be done for Node-RED 2.1.x

I see that node-red-contrib-actionflows get version bump to 2.1.1 but according to flows.nodered.org and npmjs.com it is not (yet?) released?

Maybe it was overlooked during the last update ... or maybe this plugin is still not ready for 2.1.x

@Steveorevo
Copy link
Owner

I don't see any pull requests to merge; at least not for this specific issue. I'll have to see about getting Node-RED 2.1.X up and running on a system to test. Which platform (win/mac/pi) are you on; just for reference?

@outlying
Copy link

@Steveorevo I thought that maybe this 0558040 was supposed to be released as a version compatible with 2.1.x

Platform, in my case, will be Pi3

@outlying
Copy link

outlying commented Jan 3, 2022

Small tip for ppl in the same situation - actionflows was preinstalled in my copy of NodeRed integration for HA so it was always there, after removing actionflow from my flows I still had issues with deploy, disabling actionflow in pallete will not help you and uninstalling it is not obvious, you have to go to you NodeRed configuration tab in HA (Addons) and modify your configuration like that:

init_commands: 
    - npm uninstall node-red-contrib-actionflows

At least for now I can deploy without any issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants